oracle database 12c lab file

484 12 0
  • Loading ...
1/484 trang
Tải xuống

Thông tin tài liệu

Ngày đăng: 25/11/2016, 19:13

Unauthorized reproduction or distribution prohibited Copyright© 2013, Oracle and/or its affiliates Global Information Technology a s a )h om c Oracle Database 12c: chNew e ide t i u l Features for Administrators ba ent G o l g tud Activity Guide @ o nf this S i ( gy use o l no e to h c Te cens n tio le li a rm erab o f In ansf l a b tr Glo nonD77758GC10 Edition 1.0 June 2013 D80606 Global Information Technology Copyright © 2013, Oracle and/or its affiliates All rights reserved Unauthorized reproduction or distribution prohibited Copyright© 2013, Oracle and/or its affiliates Disclaimer This document contains proprietary information and is protected by copyright and other intellectual property laws You may copy and print this document solely for your own use in an Oracle training course The document may not be modified or altered in any way Except where your use constitutes "fair use" under copyright law, you may not use, share, download, upload, copy, print, display, perform, reproduce, publish, license, post, transmit, or distribute this document in whole or in part without the express authorization of Oracle The information contained in this document is subject to change without notice If you find any problems in the document, please report them in writing to: Oracle University, 500 Oracle Parkway, Redwood Shores, California 94065 USA This document is not warranted to be error-free Restricted Rights Notice If this documentation is delivered to the United States Government or anyone using the documentation on behalf of the United States Government, the following notice is applicable: U.S GOVERNMENT RIGHTS The U.S Government’s rights to use, modify, reproduce, release, perform, display, or disclose these training materials are restricted by the terms of the applicable Oracle license agreement and/or the applicable U.S Government contract Trademark Notice a s a )h Oracle and Java are registered trademarks of Oracle and/or its affiliates Other names may be trademarks of their respective owners om c ch ide Authors e t i l- t Gu a Dominique Jeunot, Jean-François Verrier b lo den g @ Stu Technical Contributors and Reviewers o f isPeter Fusek, Dimpi Sarmah, James Spiller, Donna Keesling, Maria Billings, Lachlan (in Williams, h t y gJoel Goodman, Branislav Valny, Christina Nayagam, Franklo Fu, Gerlinde Frenzen, Harald Van se Malareddy u o Breederode, Herbert Bradbury, Hermann Baer, Jim Stenoish, Goutam, Patricia o tMcguirk, hn Robert c e Mcelroy, Paul Needham, Puneet e Sangar, Sailaja Pasupuleti, Sean Kim, s Vimala Jacob n T Sharath Bhujani, Steven Wertheimer, Uwe Hesse, e n o lic i t e a l b Oracle Tutor rm erusing: a o This book was published f In ansf l a b tr Glo non- Global Information Technology Unauthorized reproduction or distribution prohibited Copyright© 2013, Oracle and/or its affiliates Table of Contents Practices for Lesson 1: Enterprise Manager Cloud Control and Other Tools 1-1 Practices for Lesson 1: Overview 1-2 Practice 1-1: Accessing Enterprise Manager 1-3 Practice 1-2: Adding a Database Instance as a New Target Monitored by EM Cloud Control .1-6 Practice 1-3: Creating New Named Credentials .1-9 Practice 1-4: Testing the Named Credential 1-11 Practices for Lesson 2: Basics of Multitenant Container Database and Pluggable Databases 2-1 Practices for Lesson 2: Overview 2-2 Practice 2-1: Exploring CDB Architecture and Structures 2-3 Practices for Lesson 3: Creating a Multitenant Container Database and Pluggable Databases 3-1 Practices for Lesson 3-2 Practice 3-1: Creating a New CDB 3-3 Practice 3-2: Exploring CDB and PDB Structures 3-7 Practice 3-3: Creating a PDB from Seed 3-19 Practice 3-4: Cloning PDB Within the Same CDB 3-27 Practice 3-5: Plugging a Non-CDB into a CDB 3-38 Practice 3-6: Merging All PDBs of CDBs into a Single CDB 3-45 Practice 3-7: Dropping a PDB (optional) 3-50 a s a )h om c ch ide e t i u Practices for Lesson 4: Managing a Multitenant Container Database and Pluggable 4-1 l- Databases G a t b Practices for Lesson 4-2 lo den g Practice 4-1: Shutdown and Startup of the CDB 4-3 @ Stu o f Practice 4-2: Closing and Opening a PDB .4-8 n this (i 4-14 Practice 4-3: Creating After Startup Trigger to Open All PDBs y og use l Practice 4-4: Changing PDBs' Open Mode 4-16 o n onePDBs to (optional) 4-18 Practice 4-5: Instance Parameter Changes: hImpact c e s T cenand Users in a CDB and PDBs 5-1 Practices for Lesson 5: Managing Tablespaces n o li Practices for Lesson 5-2 ti e a l b .5-3 Practice 5-1: Managing rm Tablespaces a r o f e Practice 5-2: Common InManaging sf and Local Users 5-11 l n a a Practice 5-3: Managing Local and Common Roles 5-19 b n-tr o l G Practicen5-4: o Managing Local and Common Privileges 5-27 Practices for Lesson 6: Backup, Recovery, Flashback CDB and PDBs 6-1 Practices for Lesson 6-2 Practice 6-1: Cold CDB Backup .6-3 Practice 6-2: RMAN Whole CDB Backup .6-5 Practice 6-3: RMAN CDB / PDB Backup 6-8 Practice 6-4: RMAN Recovery from SYSTEM PDB Data File Loss .6-10 Practice 6-5: RMAN Recovery from Non-Essential PDB Data File Loss 6-14 Practice 6-6: SQL PDB Hot Backup (optional) .6-18 Practice 6-7: SQL Control File Backup (optional) 6-20 Practice 6-8: RMAN Recovery from Control File Loss (optional) 6-21 Practice 6-9: RMAN Recovery from Redo Log File Member Loss (optional) 6-26 Practice 6-10: RMAN Recovery from SYSTEM Root Data File Loss (optional) .6-29 Practice 6-11: RMAN Recovery from Non-Essential Root Data File Loss (optional) 6-33 Practice 6-12: PITR on PDB Tablespaces (optional) .6-35 Practice 6-13: Flashback from Common User Drop (optional) .6-42 Copyright © 2013, Oracle and/or its affiliates All rights reserved Oracle Database 12c: New Features for Administrators Table of Contents i Unauthorized reproduction or distribution prohibited Copyright© 2013, Oracle and/or its affiliates Global Information Technology Practices for Lesson 7: Heat Map, Automatic Data Optimization and Online Datafile Move 7-1 Practices for Lesson 7-2 Practice 7-1: Enabling Heat Map 7-3 Practice 7-2: Automatic Data Optimization – Creating a TIER Policy 7-5 Practice 7-3: Automatic Data Optimization – Creating a COMPRESS Policy 7-14 Practice 7-4: Cleanup ADO Policies and Heat Map Statistics 7-26 Practice 7-5: Moving Data File Online 7-28 Practices for Lesson 8: In-Database Archiving and Temporal Validity .8-1 Practices for Lesson 8-2 Practice 8-1: In-Database Archiving – Row-archival 8-3 Practice 8-2: Temporal Validity 8-8 Practice 8-3: Collecting User Context in FDA History Tables (optional) 8-18 Practice 8-4: Cleaning Up FDA 8-24 Practices for Lesson 9: Auditing 9-1 Practices for Lesson 9-2 Practice 9-1: Enabling Unified Auditing 9-3 Practice 9-2: Auditing Data Pump Export .9-9 Practice 9-3: Auditing RMAN Backups 9-13 a s a )h om c ch ide e t i l- t Gu a b lo den g @ Stu o f (in this y og use l o to Practices for Lesson 11: Oracle Data Redaction hn 11-1 c e e s Practices for Lesson 11 11-2 T cen n o Practice 11-1: Redacting Protected li Values with FULL Redaction 11-3 i Column t e a l Practice 11-2: Redacting bColumn Values with PARTIAL Redaction (optional) 11-7 rm UpProtected a r o f e Practice 11-3: Cleaning Redaction Policies 11-10 n nsf I l Practices ra12: Recovery Manager New Features and Temporal History Enhancements 12-1 bafor Lesson t o l n G Practicesnofor Lesson 12 12-2 Practice 12-1: Using SYSBACKUP in RMAN 12-3 Practices for Lesson 10: Privileges 10-1 Practices for Lesson 10 10-2 Practice 10-1: Manage Password File with SYSBACKUP Entry 10-3 Practice 10-2: Capturing Privileges 10-8 Practice 10-3: Capture Privileges Used Through Roles (Optional) 10-17 Practice 10-4: Capture Privileges Used In Contexts (Optional) 10-21 Practice 10-5: Use INHERIT PRIVILEGES Privilege .10-24 Practice 10-6: INHERIT PRIVILEGES Privilege and BEQUEATH Views .10-27 Practice 12-2: Recovering a Table by Using Table Recovery 12-9 Practices for Lesson 13: Real-Time Database Operation Monitoring 13-1 Practices for Lesson 13: Overview 13-2 Practice 13-1: Starting Enterprise Manager Database Express .13-3 Practice 13-2: Identifying and Starting Database Operations 13-7 Practice 13-3: Identifying and Starting Database Load Operations (Optional) .13-14 Practice 13-4: Cleaning Up 13-16 Practices for Lesson 14: Schema and Data Changes Management 14-1 Practices for Lesson 14 14-2 Practice 14-1: Using Schema Change Plans 14-3 Practices for Lesson 15: SQL Tuning Enhancements 15-1 Practices for Lesson 15 15-2 Practice 15-1: Using Dynamic Plans 15-3 Copyright © 2013, Oracle and/or its affiliates All rights reserved Oracle Database 12c: New Features for Administrators Table of Contents ii Global Information Technology Practice 15-2: Using Re-optimization .15-8 Unauthorized reproduction or distribution prohibited Copyright© 2013, Oracle and/or its affiliates Practices for Lesson 16: Emergency Monitoring and Compare Period ADDM 16-1 Practices for Lesson 16 16-2 Practice 16-1: Using Emergency Monitoring 16-3 Practice 16-2: Cleaning Up 16-8 Practice 16-3: Using Compare Period ADDM (optional) 16-9 Practices for Lesson 17: Resource Manager and Other Performance Enhancements 17-1 Practices for Lesson 17 17-2 Practice 17-1: Using CDB Resource Manager Plans and Directives .17-3 Practice 17-2: Using Multi-Process Multi-Threaded Architecture 17-14 Practices for Lesson 18: Tables, Indexes and Online Operations .18-1 Practices for Lesson 18 18-2 Practice 18-1: Using Invisible Table Columns 18-3 Practice 18-2: Advanced Row Compression 18-7 Practices for Lesson 19: ADR and Network Enhancements 19-1 Practices for Lesson 19 19-2 Practice 19-1: Viewing ADR DDL Log File .19-3 a s a )h Practices for Lesson 20: Oracle Data Pump, SQL*Loader, and External Tables 20-1 m Practices for Lesson 20 20-2 co h c Practice 20-1: Creating a New non-CDB orcl3 20-3 de e i t i u l Practice 20-2: Exporting/Importing Databases in FULL TRANSPORTABLE Mode .20-5 ba ent G o Practice 20-3: Loading Data Using SQL*Loader Express Mode (Optional) 20-30 l g tud @ Practices for Lesson 21: Partitioning Enhancements 21-1 o nf this S i Practices for Lesson 21 21-2 ( gy uTables Practice 21-1: Local and Global Partial Indexing ono Partitioned se 21-3 l o Practices for Lesson 22: SQL Enhancements to Assistant for Unicode .22-1 hnand sMigration c e e Practices for Lesson 22 22-2 n 22-3 T DatacType e n Practice 22-1: Using 32K VARCHAR2 i o l ti lea SQL Row-Limiting Clause .22-11 Practice 22-2: Quering aaTable Using b m r a fo sfer n I al -tran b o Gl non Copyright © 2013, Oracle and/or its affiliates All rights reserved Oracle Database 12c: New Features for Administrators Table of Contents iii Unauthorized reproduction or distribution prohibited Copyright© 2013, Oracle and/or its affiliates Global Information Technology a s a )h om c ch ide e t i l- t Gu a b lo den g @ Stu o f (in this y og use l o hn se to c e T cen n o li ti e a l rm erab o f In ansf l a b tr Glo non- Unauthorized reproduction or distribution prohibited Copyright© 2013, Oracle and/or its affiliates Global Information Technology a s a )h om c Practices for Lesson ch1: ide e t i u l- Cloud Enterprise Manager G a t b n eTools gloOther Control@ and d u o is St f n i Chapter ( th y g se o l u o hn se to c e T cen n o li ti e a l rm erab o f In ansf l a b tr Glo non- Copyright © 2013, Oracle and/or its affiliates All rights reserved Practices for Lesson 1: Enterprise Manager Cloud Control and Other Tools Chapter - Page Global Information Technology Practices for Lesson 1: Overview Unauthorized reproduction or distribution prohibited Copyright© 2013, Oracle and/or its affiliates Practices Overview Your system currently has Oracle Database 12c software installed, as well as three pre-created database called orcl, orcl2 and cdb1 You act as an Enterprise Manager administrator You access Oracle Enterprise Manager Cloud Control 12c as the sysman user with the Oracle123 password and select Summary as your home page You start exploring some of the Oracle Enterprise Manager Cloud Control 12c functionalities through the different menus and options And lastly, you will add the orcl database as a monitored target a s a )h om c ch ide e t i l- t Gu a b lo den g @ Stu o f (in this y og use l o hn se to c e T cen n o li ti e a l rm erab o f In ansf l a b tr Glo non- Copyright © 2013, Oracle and/or its affiliates All rights reserved Practices for Lesson 1: Enterprise Manager Cloud Control and Other Tools Chapter - Page Global Information Technology Practice 1-1: Accessing Enterprise Manager Overview Unauthorized reproduction or distribution prohibited Copyright© 2013, Oracle and/or its affiliates In this practice, you access Oracle Enterprise Manager Cloud Control 12c as the sysman user with the Oracle123 password and select Summary as your home page Assumptions You reviewed the Oracle Enterprise Manager 12c: Console Overview and Customization demonstration or have the equivalent navigation knowledge Tasks Click the Firefox icon on the top panel (toolbar region) above the desktop to open a browser to access the Enterprise Manager Cloud Control console Enter the URL for Cloud Control: https://.:7802/em In the current setup, use https://localhost:7802/em If an error appears, you must first start the OMS, else proceed directly with step a Start the Enterprise Manager Repository Database em12rep if not started already a s a )h om c ch ide e t i l- t Gu a b lo den g @ Stu o f (in this y og use l o n e to hinstance Connected to an idle c e s n SQL> startup n T e lic tio started ORACLE instance e a l rm erab o f In System sf Global Area 400846848 bytes l n Total a a b n-trSize 2271568 bytes Glo nFixed o Variable Size 339740336 bytes $ oraenv ORACLE_SID = [orcl] ? em12rep The Oracle base for ORACLE_HOME=/u01/app/oracle/product/12.1.0/dbhome_1 is /u01/app/oracle $ sqlplus / as sysdba Database Buffers Redo Buffers Database mounted Database opened SQL> EXIT $ b 50331648 bytes 8503296 bytes Restart the OMS $ export OMS_HOME=/u01/app/oracle/product/middleware/oms $ $OMS_HOME/bin/emctl start oms Oracle Enterprise Manager Cloud Control 12c Release Copyright © 2013, Oracle and/or its affiliates All rights reserved Practices for Lesson 1: Enterprise Manager Cloud Control and Other Tools Chapter - Page Unauthorized reproduction or distribution prohibited Copyright© 2013, Oracle and/or its affiliates Global Information Technology Copyright (c) 1996, 2012 Oracle Corporation All rights reserved Starting Oracle Management Server Starting WebTier WebTier Successfully Started Oracle Management Server Successfully Started Oracle Management Server is Up WARNING: Limit of open file descriptors is found to be 1024 The OMS has been started but it may run out of descriptors under heavy usage For proper functioning of OMS, please set "ulimit -n" to be at least 4096 $ Most likely, you receive a Secure Connection Failed message and you need to add a security exception Click Or you can add an exception a At the end of the alert box, click I Understand the Risks b At the bottom of the page, click Add Exception c In the Add Security Exception pop-up window, click Get Certificate d Confirm that “Permanently store this exception” is selected in your training environment and click Confirm Security Exception The Enterprise Manager Cloud Control console appears Enter sysman in the User Name field and Oracle123 in the Password field Then click Login The first time a new user logs in to Enterprise Manager, a page asks you to accept the license agreement You have to accept only once Then each time you will log in to Enterprise Manager, you will not get the license agreement page a s a )h om c ch ide e t i l- t Gu a b lo den g @ Stu o f (in this y og use l o hn se to c e T cen n o li ti e a l rm erab o f In ansf l a b tr Glo non- Copyright © 2013, Oracle and/or its affiliates All rights reserved Practices for Lesson 1: Enterprise Manager Cloud Control and Other Tools Chapter - Page Unauthorized reproduction or distribution prohibited Copyright© 2013, Oracle and/or its affiliates Global Information Technology a s a )h om c ch ide e t i l- t Gu a b lo den g @ Stu o f (in this y og use l o hn se to c e T cen n o li ti e a l rm erab o f In ansf l a b tr Glo non- Copyright © 2013, Oracle and/or its affiliates All rights reserved Practices for Lesson 21: Partitioning Enhancements Chapter 21 - Page 16 Unauthorized reproduction or distribution prohibited Copyright© 2013, Oracle and/or its affiliates Global Information Technology a s a )h om c Practices for Lesson ch22: iSQL de e t i u l Enhancements Migration G t ba and n o l gfor Unicode Assistant de u t @ nf22o this S i Chapter ( gy use o l no e to h c Te cens n tio le li a rm erab o f In ansf l a b tr Glo non- Copyright © 2013, Oracle and/or its affiliates All rights reserved Practices for Lesson 22: SQL Enhancements and Migration Assistant for Unicode Chapter 22 - Page Global Information Technology Practices for Lesson 22 Practices Overview Unauthorized reproduction or distribution prohibited Copyright© 2013, Oracle and/or its affiliates In the practice for this lesson, you use the extended data type column to create columns of 32767 bytes long and the row-limiting clause to limit the rows resulting from queries a s a )h om c ch ide e t i l- t Gu a b lo den g @ Stu o f (in this y og use l o hn se to c e T cen n o li ti e a l rm erab o f In ansf l a b tr Glo non- Copyright © 2013, Oracle and/or its affiliates All rights reserved Practices for Lesson 22: SQL Enhancements and Migration Assistant for Unicode Chapter 22 - Page Global Information Technology Practice 22-1: Using 32K VARCHAR2 Data Type Overview Unauthorized reproduction or distribution prohibited Copyright© 2013, Oracle and/or its affiliates In this practice, you create a new table with a column of data type VARCHAR2(32767) Tasks Connect to the source database orcl $ oraenv ORACLE_SID = [cdb2] ? orcl The Oracle base remains unchanged with value /u01/app/oracle $ sqlplus / as sysdba Connected to: Oracle Database 12c Enterprise Edition Release 12.1.0.0.2 64bit Production With the Partitioning, OLAP, Data Mining and Real Application Testing options a s a )h om c ch ide e t i l- t Gu a SQL> b lo den g Create a table LONG_VARCHAR with a column VARCHAR2(32767) @ Stu o f is VARCHAR2(32767)); SQL> CREATE TABLE long_varchar(id (in NUMBER,vc h t y CREATE TABLE long_varchar(id se VARCHAR2(32767)) og NUMBER,vc l u o * hn se to c e ERROR at line 1:T n e n c i o l i ORA-00910: tspecified e length too long for its datatype a l b m r o f e f n I ans lSQL> a b -tr parameter MAX_STRING_SIZE to EXTENDED ninstance G3.loSetnthe o SQL> alter system set MAX_STRING_SIZE =EXTENDED; alter system set MAX_STRING_SIZE =EXTENDED * ERROR at line 1: ORA-02097: parameter cannot be modified because specified value is invalid ORA-14694: database must in UPGRADE mode to begin MAX_STRING_SIZE migration SQL> Copyright © 2013, Oracle and/or its affiliates All rights reserved Practices for Lesson 22: SQL Enhancements and Migration Assistant for Unicode Chapter 22 - Page Global Information Technology Unauthorized reproduction or distribution prohibited Copyright© 2013, Oracle and/or its affiliates Configure the database to be compatible with extended data type columns a Restart the database instance SQL> shutdown immediate Database closed Database dismounted ORACLE instance shut down SQL> SQL> startup upgrade ORACLE instance started Total System Global Area 1686925312 bytes Fixed Size 2261160 bytes Variable Size 989859672 bytes Database Buffers 687865856 bytes Redo Buffers 6938624 bytes Database mounted Database opened SQL> a s a )h om c ch ide e t i l- t Gu a b n o devalue lEXTENDED g b Set the instance parameter MAX_STRING_SIZE to the u o@= iEXTENDED; St f SQL> ALTER SYSTEM SET MAX_STRING_SIZE n s i ( th y g e lo o us o System altered n h se t c e T cen n SQL> o li ti e a l b m $ORACLE_HOME/rdbms/admin/utl32k.sql c Executerthe script as SYSDBA Be a r o f e f aware that the script may last very long (around one hour) Although, at the very last n I ans l a step when the function is being dropped and the script stuck, you can start another b session tras SYSDBA and perform task to check if the creation of the table o l n is possible G no with a VARCHAR2(32767) data type column SQL> @$ORACLE_HOME/rdbms/admin/utl32k.sql Session altered DOC>############################################################ ########### DOC>############################################################ ########### DOC> The following statement will cause an "ORA-01722: invalid number" DOC> error if the database has not been opened for UPGRADE DOC> DOC> Perform a "SHUTDOWN ABORT" and Copyright © 2013, Oracle and/or its affiliates All rights reserved Practices for Lesson 22: SQL Enhancements and Migration Assistant for Unicode Chapter 22 - Page Unauthorized reproduction or distribution prohibited Copyright© 2013, Oracle and/or its affiliates Global Information Technology DOC> restart using UPGRADE DOC>############################################################ ########### DOC>############################################################ ########### DOC># no rows selected DOC>############################################################ ########### DOC>############################################################ ########### DOC> The following statement will cause an "ORA-01722: invalid number" DOC> error if the database does not have compatible >= 12.0.0 DOC> DOC> Set compatible >= 12.0.0 and retry DOC>############################################################ ########### DOC>############################################################ ########### DOC># a s a )h om c ch ide e t i l- t Gu a b lo den g @ Stu o f (in this y se og completed l u o PL/SQL procedure successfully hn se to c e T cen n Session altered o li ti e a l rm erab o f Irows n updated sf l n a a b n-tr Glo nCommit o complete 1671 rows updated Commit complete System altered PL/SQL procedure successfully completed Commit complete System altered Copyright © 2013, Oracle and/or its affiliates All rights reserved Practices for Lesson 22: SQL Enhancements and Migration Assistant for Unicode Chapter 22 - Page Global Information Technology Session altered PL/SQL procedure successfully completed Unauthorized reproduction or distribution prohibited Copyright© 2013, Oracle and/or its affiliates No errors Session altered Package altered TIMESTAMP COMP_TIMESTAMP UTLRP_BGN 2012-07-11 08:29:59 a s a )h DOC> The following PL/SQL block invokes UTL_RECOMP to recompile invalid DOC> objects in the database Recompilation time is proportional to the DOC> number of invalid objects in the database, so this command may take DOC> a long time to execute on a database with a large number of invalid DOC> objects DOC> DOC> Use the following queries to track recompilation progress: DOC> DOC> Query returning the number of invalid objects remaining This DOC> number should decrease with time DOC> SELECT COUNT(*) FROM obj$ WHERE status IN (4, 5, 6); DOC> DOC> Query returning the number of objects compiled so far This number DOC> should increase with time DOC> SELECT COUNT(*) FROM UTL_RECOMP_COMPILED; DOC> DOC> This script automatically chooses serial or parallel recompilation DOC> based on the number of CPUs available (parameter cpu_count) multiplied DOC> by the number of threads per CPU (parameter parallel_threads_per_cpu) om c ch ide e t i l- t Gu a b lo den g @ Stu o f (in this y og use l o hn se to c e T cen n o li ti e a l rm erab o f In ansf l a b tr Glo non- Copyright © 2013, Oracle and/or its affiliates All rights reserved Practices for Lesson 22: SQL Enhancements and Migration Assistant for Unicode Chapter 22 - Page Unauthorized reproduction or distribution prohibited Copyright© 2013, Oracle and/or its affiliates Global Information Technology DOC> On RAC, this number is added across all RAC nodes DOC> DOC> UTL_RECOMP uses DBMS_SCHEDULER to create jobs for parallel DOC> recompilation Jobs are created without instance affinity so that they DOC> can migrate across RAC nodes Use the following queries to verify DOC> whether UTL_RECOMP jobs are being created and run correctly: DOC> DOC> Query showing jobs created by UTL_RECOMP DOC> SELECT job_name FROM dba_scheduler_jobs DOC> WHERE job_name like 'UTL_RECOMP_SLAVE_%'; DOC> DOC> Query showing UTL_RECOMP jobs that are running DOC> SELECT job_name FROM dba_scheduler_running_jobs DOC> WHERE job_name like 'UTL_RECOMP_SLAVE_%'; DOC># a s a )h om c ch ide e t i l- t Gu a b lo den PL/SQL procedure successfully completed g @ Stu o f (in this TIMESTAMP y og use l -o -hn se to c e T cen 2012-07-11 08:32:14 COMP_TIMESTAMP UTLRP_END n o li ti e a l b query reports the number of objects that have rmfollowing a DOC> o The r f e compiled In ansf l a r errors b DOC> twith Glo nDOC> onDOC> If the number is higher than expected, please examine the error DOC> messages reported with each object (using SHOW ERRORS) to see if they DOC> point to system misconfiguration or resource constraints that must be DOC> fixed before attempting to recompile these objects DOC># OBJECTS WITH ERRORS Copyright © 2013, Oracle and/or its affiliates All rights reserved Practices for Lesson 22: SQL Enhancements and Migration Assistant for Unicode Chapter 22 - Page Unauthorized reproduction or distribution prohibited Copyright© 2013, Oracle and/or its affiliates Global Information Technology DOC> The following query reports the number of errors caught during DOC> recompilation If this number is non-zero, please query the error DOC> messages in the table UTL_RECOMP_ERRORS to see if any of these errors DOC> are due to misconfiguration or resource constraints that must be DOC> fixed before objects can compile successfully DOC># ERRORS DURING RECOMPILATION Function created a s a )h om c ch ide e t i l- t Gu Function dropped a b lo den g tu @ "APEX_040200", Database user "SYS", database schema user# o S f n this i ( "98" 06:52:09 gy usconsidered, e Compiled out of 2992lo objects failed o o compilation 06:52:09 hn t c nse 263 packages Te nbodieslice o 255 package i t a le 453rm tablesrab fofunctions fe n 11 I s l n a ba 16 trprocedures o l n G n o sequences PL/SQL procedure successfully completed 458 triggers 1316 indexes 207 views libraries types type bodies operators index types Begin key object existence check 06:52:09 Completed key object existence check 06:52:10 Setting DBMS Registry 06:52:10 Setting DBMS Registry Complete 06:52:10 Copyright © 2013, Oracle and/or its affiliates All rights reserved Practices for Lesson 22: SQL Enhancements and Migration Assistant for Unicode Chapter 22 - Page Global Information Technology Exiting validate 06:52:10 Unauthorized reproduction or distribution prohibited Copyright© 2013, Oracle and/or its affiliates PL/SQL procedure successfully completed rows updated Commit complete SQL> d Restart the database in normal mode SQL> shutdown immediate Database closed Database dismounted ORACLE instance shut down SQL> startup ORACLE instance started a s a )h om c ch ide e t i l- t Gu Total System Global Area 1686925312 bytes a b lo den Fixed Size 2261160 bytes g @ Stu o Variable Size 989859672 bytes f is (in bytes h Database Buffers 687865856 t y sebytes og6938624 l Redo Buffers u o n e to Database mounted ch e T cens Database opened n tio le li SQL> a b rmthe MAX_STRING_SIZE a r o f e e Verify that is set to EXTENDED n nsf I l parameter MAX_STRING_SIZE baSQL> tshow o l n G no NAME TYPE VALUE - -max_string_size string EXTENDED SQL> Copyright © 2013, Oracle and/or its affiliates All rights reserved Practices for Lesson 22: SQL Enhancements and Migration Assistant for Unicode Chapter 22 - Page Global Information Technology Create a table with an extended data type column of 32767 bytes Unauthorized reproduction or distribution prohibited Copyright© 2013, Oracle and/or its affiliates SQL> CREATE TABLE long_varchar(id NUMBER,vc VARCHAR2(32767)); Table created SQL> DESC long_varchar Name Null? - -ID VC Type -NUMBER VARCHAR2(32767) SQL> a s a )h om c ch ide e t i l- t Gu a b lo den g @ Stu o f (in this y og use l o hn se to c e T cen n o li ti e a l rm erab o f In ansf l a b tr Glo non- Copyright © 2013, Oracle and/or its affiliates All rights reserved Practices for Lesson 22: SQL Enhancements and Migration Assistant for Unicode Chapter 22 - Page 10 Global Information Technology Practice 22-2: Quering a Table Using a SQL Row-Limiting Clause Overview Unauthorized reproduction or distribution prohibited Copyright© 2013, Oracle and/or its affiliates In this practice, you limit the number or rows returned by a query that orders data Tasks Count the number of rows in the HR.EMPLOYEES table SQL> select count(*) from hr.employees; COUNT(*) -83 SQL> a s a )h Select the EMPLOYEE_ID and LAST_NAME of the first 10 employees ordered by their last name om c ch ide e t i l- t Gu a b lo den g @ Stu EMPLOYEE_ID LAST_NAME o f - (in this y 174 Abel og use l o 166 Ande hn se to c e 105 Austin T cen n o 204 tiBaer le li a b 167 rm eBanda a r o f In 172ansf Bates l a b tr 192 Bell Glo non-151 Bernstein SQL> SELECT employee_id, last_name FROM hr.employees ORDER BY last_name FETCH FIRST 10 ROWS ONLY; 129 169 Bissot Bloom 10 rows selected SQL> You see the first 10 employees ordered by their last name The first of them has a name starting with letter A Copyright © 2013, Oracle and/or its affiliates All rights reserved Practices for Lesson 22: SQL Enhancements and Migration Assistant for Unicode Chapter 22 - Page 11 Global Information Technology Select the EMPLOYEE_ID, LAST_NAME and HIRE_DATE of the first 10 employees ordered by their hire date Unauthorized reproduction or distribution prohibited Copyright© 2013, Oracle and/or its affiliates SQL> SELECT employee_id,last_name, hire_date FROM hr.employees ORDER BY hire_date FETCH FIRST 10 ROWS ONLY; EMPLOYEE_ID 102 203 206 205 204 109 108 114 122 115 LAST_NAME De Haan Mavris Gietz Higgins Baer Faviet Greenberg Raphaely Kaufling Khoo HIRE_DATE 13-JAN-01 07-JUN-02 07-JUN-02 07-JUN-02 07-JUN-02 16-AUG-02 17-AUG-02 07-DEC-02 01-MAY-03 18-MAY-03 EMPLOYEE_ID 100 137 200 141 184 LAST_NAME King Ladwig Whalen Rajs Sarchand HIRE_DATE 17-JUN-03 14-JUL-03 17-SEP-03 17-OCT-03 27-JAN-04 a s a )h om c ch ide e t i l- t Gu a b 10 rows selected lo den g @ Stu o f SQL> (in this y g usedate The first hired one was the You see the first 10 employees orderedlo by their hire o employee De Haan hn se to c e Select the EMPLOYEE_ID,T LAST_NAME n and HIRE_DATE of the next employees ordered e n c i o l by their hire date coming the previous ones ti after e a l b m SQL> SELECT employee_id,last_name, hire_date FROM hr.employees r o f e f n l I2 ORDER ns BY hire_date a a r b t OFFSET 10 ROWS FETCH NEXT ROWS ONLY; Glo non- SQL> Copyright © 2013, Oracle and/or its affiliates All rights reserved Practices for Lesson 22: SQL Enhancements and Migration Assistant for Unicode Chapter 22 - Page 12 Global Information Technology Select the EMPLOYEE_ID and LAST_NAME of the first 8% of the employees ordered by their employee identifier Unauthorized reproduction or distribution prohibited Copyright© 2013, Oracle and/or its affiliates SQL> SELECT employee_id, last_name FROM hr.employees ORDER BY employee_id FETCH FIRST PERCENT ROWS ONLY; EMPLOYEE_ID 100 101 102 103 104 105 106 LAST_NAME King Kochhar De Haan Hunold Ernst Austin Pataballa a s a )h om c ch ide e t i l- t Gu SQL> EXIT a b lo den $ g tu The first one is the @ identifier You see the first seven employees ordered by theirfo employee S (in this7 rows employee 100 % of 83 rows correspond to approximately y og use l o hn se to c e T cen n o li ti e a l rm erab o f In ansf l a b tr Glo non7 rows selected Copyright © 2013, Oracle and/or its affiliates All rights reserved Practices for Lesson 22: SQL Enhancements and Migration Assistant for Unicode Chapter 22 - Page 13 Unauthorized reproduction or distribution prohibited Copyright© 2013, Oracle and/or its affiliates Global Information Technology a s a )h om c ch ide e t i l- t Gu a b lo den g @ Stu o f (in this y og use l o hn se to c e T cen n o li ti e a l rm erab o f In ansf l a b tr Glo non- Copyright © 2013, Oracle and/or its affiliates All rights reserved Practices for Lesson 22: SQL Enhancements and Migration Assistant for Unicode Chapter 22 - Page 14 [...]... terminal window $ oraenv ORACLE_ SID = [oracle] ? orcl The Oracle base for ORACLE_ HOME=/u01/app /oracle/ product/12.1.0/dbhome_1 is /u01/app /oracle $ sqlplus / as sysdba Connected to: Oracle Database 12c Enterprise Edition Release 12.1.0.0.2 64bit Production With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options a s a SQL> alter user dbsnmp identified by oracle_ 4U account unlock;... Still connected to the root, now use DBA_DATA_FILES view SQL> col file_ name format A42 SQL> select FILE_ NAME, TABLESPACE_NAME, FILE_ ID 2 from dba_data_files; FILE_ NAME TABLESPA FILE_ ID Copyright © 2013, Oracle and/or its affiliates All rights reserved Practices for Lesson 2: Basics of Multitenant Container Database and Pluggable Databases Chapter 2 - Page 12 Global Information... 3 3 EXAMPLE 4 3 SQL> f List the temp files of the CDB SQL> col file_ name format A47 SQL> select FILE_ NAME, TABLESPACE_NAME, FILE_ ID 2 from cdb_temp_files; FILE_ NAME TABLESPA FILE_ ID - Copyright © 2013, Oracle and/or its affiliates All rights reserved Practices for Lesson 2: Basics of Multitenant Container Database and Pluggable Databases Chapter 2 - Page 13 Unauthorized... ora_dbrm_cdb1 oracle 27568 1 0 13:24 ? 00:00:11 ora_dia0_cdb1 oracle 27572 1 0 13:24 ? 00:00:02 ora_dbw0_cdb1 oracle 27576 1 0 13:24 ? 00:00:01 ora_lgwr_cdb1 oracle 27580 1 0 13:24 ? 00:00:03 ora_ckpt_cdb1 oracle 27584 1 0 13:24 ? 00:00:00 ora_smon_cdb1 oracle 27588 1 0 13:24 ? 00:00:00 ora_reco_cdb1 oracle 27592 1 0 13:24 ? 00:00:00 ora_lreg_cdb1 oracle 27596 1 0 13:24 ? 00:00:15 ora_mmon_cdb1 oracle 27600... ora_mmnl_cdb1 oracle 27604 1 0 13:24 ? 00:00:00 ora_d000_cdb1 oracle 27608 1 0 13:24 ? 00:00:00 ora_s000_cdb1 oracle 27630 1 0 13:25 ? 00:00:00 ora_tmon_cdb1 oracle 27634 1 0 13:25 ? 00:00:00 ora_tt00_cdb1 oracle 27638 1 0 13:25 ? 00:00:00 ora_fbda_cdb1 oracle 27642 1 0 13:25 ? 00:00:00 ora_aqpc_cdb1 oracle 27651 1 0 13:25 ? 00:00:00 ora_p000_cdb1 oracle 27659 1 0 13:25 ? 00:00:00 ora_p001_cdb1 oracle 27666... 2013, Oracle and/or its affiliates Global Information Technology oracle oracle oracle oracle oracle $ b 27734 27738 27742 27750 31695 1 1 1 1 1 0 0 0 0 0 13:25 13:25 13:25 13:25 17:05 ? ? ? ? ? 00:00:00 00:00:00 00:00:00 00:00:00 00:00:00 ora_qm01_cdb1 ora_q001_cdb1 ora_q002_cdb1 ora_smco_cdb1 ora_w002_cdb1 Connect to the multitenant container database cdb1 $ oraenv ORACLE_ SID = [orcl] ? cdb1 The Oracle. .. distribution prohibited Copyright© 2013, Oracle and/or its affiliates Practices Overview In previous Oracle Database versions, you used to create, configure, and manage non-CDBs In Oracle Database 12c, you need to know how to create, configure, and manage multitenant container databases (CDBs) and pluggable databases (PDBs) In this practice, you will explore new types of databases and get familiar with the... ora_w001_cdb1 oracle 2711 2686 0 18:32 pts/2 00:00:00 grep cdb1 oracle 27530 1 0 13:24 ? 00:00:02 ora_pmon_cdb1 oracle 27534 1 0 13:24 ? 00:00:04 ora_psp0_cdb1 oracle 27538 1 1 13:24 ? 00:05:01 ora_vktm_cdb1 oracle 27544 1 0 13:24 ? 00:00:00 ora_gen0_cdb1 oracle 27548 1 0 13:24 ? 00:00:00 ora_mman_cdb1 oracle 27556 1 0 13:24 ? 00:00:00 ora_diag_cdb1 oracle 27560 1 0 13:24 ? 00:00:00 ora_ofsd_cdb1 oracle 27564... e s n T 2 from cdb_data_files n ce order by con_id ; i o l i t a le b m r a FILE_ NAME TABLESPA r o f e f n I anCON_ID s lFILE_ID a r b t - -Glo n on SQL> /u01/app /oracle/ oradata/cdb1/users01.dbf 6 1 /u01/app /oracle/ oradata/cdb1/undotbs01.dbf 4 1 /u01/app /oracle/ oradata/cdb1/sysaux01.dbf 3 1 /u01/app /oracle/ oradata/cdb1/system01.dbf 1 1 /u01/app /oracle/ oradata/cdb1/pdbseed/system01.dbf... Copyright© 2013, Oracle and/or its affiliates /u01/app /oracle/ oradata/cdb1/users01.dbf 6 /u01/app /oracle/ oradata/cdb1/undotbs01.dbf /u01/app /oracle/ oradata/cdb1/sysaux01.dbf /u01/app /oracle/ oradata/cdb1/system01.dbf USERS UNDOTBS1 SYSAUX SYSTEM 4 3 1 SQL> Notice that only the root data files are listed e Now use V$TABLESPACE and V$DATAFILE view SQL> SQL> 2 3 4 5 col NAME format A12 select FILE# , ts.name,
- Xem thêm -

Xem thêm: oracle database 12c lab file, oracle database 12c lab file, oracle database 12c lab file

Gợi ý tài liệu liên quan cho bạn

Nạp tiền Tải lên
Đăng ký
Đăng nhập