|
上完1Z0-053第5/6章
预习备份恢复视频
1Z0-052共19章(上完12章),1Z0-053共21章(上完10章)和1Z0-063多租户部分共9章(上完0章)
总共上完全部49章中的22章
- [root@station90 桌面]# su - oracle
- [oracle@station90 ~]$ . oraenv
- ORACLE_SID = [orcl] ? rcat
- The Oracle base for ORACLE_HOME=/u01/app/oracle/product/11.2.0/dbhome_1 is /u01/app/oracle
- [oracle@station90 ~]$ sqlplus /nolog
- SQL*Plus: Release 11.2.0.1.0 Production on Sun May 20 19:42:50 2018
- Copyright (c) 1982, 2009, Oracle. All rights reserved.
- SQL> conn / as sysdba
- Connected.
- SQL> show parameter db_name
- NAME TYPE VALUE
- ------------------------------------ ----------- ------------------------------
- db_name string rcat
- SQL> select open_mode from v$database;
- OPEN_MODE
- --------------------
- READ WRITE
- SQL> exit
- Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
- With the Partitioning, OLAP, Data Mining and Real Application Testing options
- [oracle@station90 ~]$ cd /u01/app/oracle/oradata/
- [oracle@station90 oradata]$ ls
- rcat
- [oracle@station90 oradata]$ cd rcat/
- [oracle@station90 rcat]$ ls
- control01.ctl rcat01.dbf redo02.log sysaux01.dbf temp01.dbf users01.dbf
- example01.dbf redo01.log redo03.log system01.dbf undotbs01.dbf
- [oracle@station90 rcat]$ rm -i temp01.dbf
- rm:是否删除普通文件 "temp01.dbf"?y
- [oracle@station90 rcat]$ ls -l /u01/app/oracle/oradata/rcat/temp01.dbf
- ls: 无法访问/u01/app/oracle/oradata/rcat/temp01.dbf: 没有那个文件或目录
- [oracle@station90 rcat]$ sqlplus /nolog
- SQL*Plus: Release 11.2.0.1.0 Production on Sun May 20 19:44:18 2018
- Copyright (c) 1982, 2009, Oracle. All rights reserved.
- SQL> conn hr/oracle_4U
- ERROR:
- ORA-28000: the account is locked
- SQL> conn hr/oracle_4U
- Connected.
- SQL> select * from employees a , employees b , employees c , employees d order 1 ,2,3,4,5;
- select * from employees a , employees b , employees c , employees d order 1 ,2,3,4,5
- *
- ERROR at line 1:
- ORA-00924: missing BY keyword
- SQL> select * from employees a , employees b , employees c , employees d order by 1 ,2,3,4,5;
- select * from employees a , employees b , employees c , employees d order by 1 ,2,3,4,5
- *
- ERROR at line 1:
- ORA-01116: error in opening database file 201
- ORA-01110: data file 201: '/u01/app/oracle/oradata/rcat/temp01.dbf'
- ORA-27041: unable to open file
- Linux-x86_64 Error: 2: No such file or directory
- Additional information: 3
- SQL> /
- select * from employees a , employees b , employees c , employees d order by 1 ,2,3,4,5
- *
- ERROR at line 1:
- ORA-01013: user requested cancel of current operation
- SQL> conn / as sysdba
- SQL> conn / as sysdba
- Connected.
- SQL> archive log list;
- Database log mode No Archive Mode
- Automatic archival Disabled
- Archive destination USE_DB_RECOVERY_FILE_DEST
- Oldest online log sequence 6
- Current log sequence 8
- SQL> shutdown immediate
- Database closed.
- Database dismounted.
- ORACLE instance shut down.
- SQL> startup mount
- ORACLE instance started.
- Total System Global Area 1603411968 bytes
- Fixed Size 2213776 bytes
- Variable Size 436209776 bytes
- Database Buffers 1157627904 bytes
- Redo Buffers 7360512 bytes
- Database mounted.
- SQL> alter database archivelog ;
- Database altered.
- SQL> alter database open ;
- Database altered.
- SQL> begin
- 2 for i in 1..10000
- 3 loop
- 4 update employees set salary=salary+1 where employee_id=100;
- 5 end loop;
- 6 commit;
- 7 end;
- 8 /
- update employees set salary=salary+1 where employee_id=100;
- *
- ERROR at line 4:
- ORA-06550: line 4, column 12:
- PL/SQL: ORA-00942: table or view does not exist
- ORA-06550: line 4, column 5:
- PL/SQL: SQL Statement ignored
- SQL> conn hr/oracle_4U
- Connected.
- SQL> begin
- 2 for i in 1..100000
- 3 loop
- 4 update employees set salary=salary+1 where employee_id=100;
- 5 end loop;
- 6 commit;
- 7 end;
- 8 /
- PL/SQL procedure successfully completed.
- SQL> exit
- Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
- With the Partitioning, OLAP, Data Mining and Real Application Testing options
- [oracle@station90 rcat]$ rman target /
- Recovery Manager: Release 11.2.0.1.0 - Production on Sun May 20 20:15:12 2018
- Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.
- connected to target database: RCAT (DBID=590260915)
- RMAN> show all;
- using target database control file instead of recovery catalog
- RMAN configuration parameters for database with db_unique_name RCAT are:
- CONFIGURE RETENTION POLICY TO REDUNDANCY 1; # default
- CONFIGURE BACKUP OPTIMIZATION OFF; # default
- CONFIGURE DEFAULT DEVICE TYPE TO DISK; # default
- CONFIGURE CONTROLFILE AUTOBACKUP OFF; # default
- CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '%F'; # default
- CONFIGURE DEVICE TYPE DISK PARALLELISM 1 BACKUP TYPE TO BACKUPSET; # default
- CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
- CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
- CONFIGURE MAXSETSIZE TO UNLIMITED; # default
- CONFIGURE ENCRYPTION FOR DATABASE OFF; # default
- CONFIGURE ENCRYPTION ALGORITHM 'AES128'; # default
- CONFIGURE COMPRESSION ALGORITHM 'BASIC' AS OF RELEASE 'DEFAULT' OPTIMIZE FOR LOAD TRUE ; # default
- CONFIGURE ARCHIVELOG DELETION POLICY TO NONE; # default
- CONFIGURE SNAPSHOT CONTROLFILE NAME TO '/u01/app/oracle/product/11.2.0/dbhome_1/dbs/snapcf_rcat.f'; # default
- RMAN> backup incremental level 0 database ;
- Starting backup at 20-MAY-18
- allocated channel: ORA_DISK_1
- channel ORA_DISK_1: SID=11 device type=DISK
- channel ORA_DISK_1: starting incremental level 0 datafile backup set
- channel ORA_DISK_1: specifying datafile(s) in backup set
- input datafile file number=00001 name=/u01/app/oracle/oradata/rcat/system01.dbf
- input datafile file number=00002 name=/u01/app/oracle/oradata/rcat/sysaux01.dbf
- input datafile file number=00005 name=/u01/app/oracle/oradata/rcat/example01.dbf
- input datafile file number=00006 name=/u01/app/oracle/oradata/rcat/rcat01.dbf
- input datafile file number=00003 name=/u01/app/oracle/oradata/rcat/undotbs01.dbf
- input datafile file number=00004 name=/u01/app/oracle/oradata/rcat/users01.dbf
- channel ORA_DISK_1: starting piece 1 at 20-MAY-18
- channel ORA_DISK_1: finished piece 1 at 20-MAY-18
- piece handle=/u01/app/oracle/flash_recovery_area/RCAT/backupset/2018_05_20/o1_mf_nnnd0_TAG20180520T201530_fj2sq2m7_.bkp tag=TAG20180520T201530 comment=NONE
- channel ORA_DISK_1: backup set complete, elapsed time: 00:00:07
- channel ORA_DISK_1: starting incremental level 0 datafile backup set
- channel ORA_DISK_1: specifying datafile(s) in backup set
- including current control file in backup set
- including current SPFILE in backup set
- channel ORA_DISK_1: starting piece 1 at 20-MAY-18
- channel ORA_DISK_1: finished piece 1 at 20-MAY-18
- piece handle=/u01/app/oracle/flash_recovery_area/RCAT/backupset/2018_05_20/o1_mf_ncsn0_TAG20180520T201530_fj2sqblt_.bkp tag=TAG20180520T201530 comment=NONE
- channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
- Finished backup at 20-MAY-18
- RMAN> backup incremental level 1 database ;
- Starting backup at 20-MAY-18
- using channel ORA_DISK_1
- channel ORA_DISK_1: starting incremental level 1 datafile backup set
- channel ORA_DISK_1: specifying datafile(s) in backup set
- input datafile file number=00001 name=/u01/app/oracle/oradata/rcat/system01.dbf
- input datafile file number=00002 name=/u01/app/oracle/oradata/rcat/sysaux01.dbf
- input datafile file number=00005 name=/u01/app/oracle/oradata/rcat/example01.dbf
- input datafile file number=00006 name=/u01/app/oracle/oradata/rcat/rcat01.dbf
- input datafile file number=00003 name=/u01/app/oracle/oradata/rcat/undotbs01.dbf
- input datafile file number=00004 name=/u01/app/oracle/oradata/rcat/users01.dbf
- channel ORA_DISK_1: starting piece 1 at 20-MAY-18
- channel ORA_DISK_1: finished piece 1 at 20-MAY-18
- piece handle=/u01/app/oracle/flash_recovery_area/RCAT/backupset/2018_05_20/o1_mf_nnnd1_TAG20180520T201545_fj2sqkt1_.bkp tag=TAG20180520T201545 comment=NONE
- channel ORA_DISK_1: backup set complete, elapsed time: 00:00:03
- channel ORA_DISK_1: starting incremental level 1 datafile backup set
- channel ORA_DISK_1: specifying datafile(s) in backup set
- including current control file in backup set
- including current SPFILE in backup set
- channel ORA_DISK_1: starting piece 1 at 20-MAY-18
- channel ORA_DISK_1: finished piece 1 at 20-MAY-18
- piece handle=/u01/app/oracle/flash_recovery_area/RCAT/backupset/2018_05_20/o1_mf_ncsn1_TAG20180520T201545_fj2sqown_.bkp tag=TAG20180520T201545 comment=NONE
- channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
- Finished backup at 20-MAY-18
- RMAN> list backup of database;
- List of Backup Sets
- ===================
- BS Key Type LV Size Device Type Elapsed Time Completion Time
- ------- ---- -- ---------- ----------- ------------ ---------------
- 1 Incr 0 1.05G DISK 00:00:07 20-MAY-18
- BP Key: 1 Status: AVAILABLE Compressed: NO Tag: TAG20180520T201530
- Piece Name: /u01/app/oracle/flash_recovery_area/RCAT/backupset/2018_05_20/o1_mf_nnnd0_TAG20180520T201530_fj2sq2m7_.bkp
- List of Datafiles in backup set 1
- File LV Type Ckp SCN Ckp Time Name
- ---- -- ---- ---------- --------- ----
- 1 0 Incr 1080567 20-MAY-18 /u01/app/oracle/oradata/rcat/system01.dbf
- 2 0 Incr 1080567 20-MAY-18 /u01/app/oracle/oradata/rcat/sysaux01.dbf
- 3 0 Incr 1080567 20-MAY-18 /u01/app/oracle/oradata/rcat/undotbs01.dbf
- 4 0 Incr 1080567 20-MAY-18 /u01/app/oracle/oradata/rcat/users01.dbf
- 5 0 Incr 1080567 20-MAY-18 /u01/app/oracle/oradata/rcat/example01.dbf
- 6 0 Incr 1080567 20-MAY-18 /u01/app/oracle/oradata/rcat/rcat01.dbf
- BS Key Type LV Size Device Type Elapsed Time Completion Time
- ------- ---- -- ---------- ----------- ------------ ---------------
- 3 Incr 1 72.00K DISK 00:00:01 20-MAY-18
- BP Key: 3 Status: AVAILABLE Compressed: NO Tag: TAG20180520T201545
- Piece Name: /u01/app/oracle/flash_recovery_area/RCAT/backupset/2018_05_20/o1_mf_nnnd1_TAG20180520T201545_fj2sqkt1_.bkp
- List of Datafiles in backup set 3
- File LV Type Ckp SCN Ckp Time Name
- ---- -- ---- ---------- --------- ----
- 1 1 Incr 1080587 20-MAY-18 /u01/app/oracle/oradata/rcat/system01.dbf
- 2 1 Incr 1080587 20-MAY-18 /u01/app/oracle/oradata/rcat/sysaux01.dbf
- 3 1 Incr 1080587 20-MAY-18 /u01/app/oracle/oradata/rcat/undotbs01.dbf
- 4 1 Incr 1080587 20-MAY-18 /u01/app/oracle/oradata/rcat/users01.dbf
- 5 1 Incr 1080587 20-MAY-18 /u01/app/oracle/oradata/rcat/example01.dbf
- 6 1 Incr 1080587 20-MAY-18 /u01/app/oracle/oradata/rcat/rcat01.dbf
- RMAN> exit
- Recovery Manager complete.
- [oracle@station90 rcat]$ sqlplus /nolog
- SQL*Plus: Release 11.2.0.1.0 Production on Sun May 20 20:16:43 2018
- Copyright (c) 1982, 2009, Oracle. All rights reserved.
- SQL> conn hr/oracle_4U
- Connected.
- SQL> begin
- 2 for i in 1..100000
- 3 loop
- 4 update employees set salary=salary+1 where employee_id=101;
- 5 end loop;
- 6 commit;
- 7 end;
- 8 /
- PL/SQL procedure successfully completed.
- SQL> conn / as sysdba
- Connected.
- SQL> shutdown immediate
- Database closed.
- Database dismounted.
- ORACLE instance shut down.
- SQL> startup
- ORACLE instance started.
- Total System Global Area 1603411968 bytes
- Fixed Size 2213776 bytes
- Variable Size 436209776 bytes
- Database Buffers 1157627904 bytes
- Redo Buffers 7360512 bytes
- Database mounted.
- ORA-03113: end-of-file on communication channel
- Process ID: 2753
- Session ID: 919 Serial number: 5
- SQL> conn / as sysdba
- Connected to an idle instance.
- SQL> startup mount
- ORACLE instance started.
- Total System Global Area 1603411968 bytes
- Fixed Size 2213776 bytes
- Variable Size 436209776 bytes
- Database Buffers 1157627904 bytes
- Redo Buffers 7360512 bytes
- Database mounted.
- SQL> alter database open ;
- alter database open
- *
- ERROR at line 1:
- ORA-03113: end-of-file on communication channel
- Process ID: 2815
- Session ID: 919 Serial number: 5
- SQL> conn / as sysdba
- Connected to an idle instance.
- SQL> startup mount
- ORACLE instance started.
- Total System Global Area 1603411968 bytes
- Fixed Size 2213776 bytes
- Variable Size 436209776 bytes
- Database Buffers 1157627904 bytes
- Redo Buffers 7360512 bytes
- Database mounted.
- SQL> exit
- Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
- With the Partitioning, OLAP, Data Mining and Real Application Testing options
- [oracle@station90 rcat]$ rman target /
- Recovery Manager: Release 11.2.0.1.0 - Production on Sun May 20 20:19:27 2018
- Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.
- connected to target database: RCAT (DBID=590260915, not open)
- RMAN> restore database ;
- Starting restore at 20-MAY-18
- using target database control file instead of recovery catalog
- allocated channel: ORA_DISK_1
- channel ORA_DISK_1: SID=310 device type=DISK
- channel ORA_DISK_1: starting datafile backup set restore
- channel ORA_DISK_1: specifying datafile(s) to restore from backup set
- channel ORA_DISK_1: restoring datafile 00001 to /u01/app/oracle/oradata/rcat/system01.dbf
- channel ORA_DISK_1: restoring datafile 00002 to /u01/app/oracle/oradata/rcat/sysaux01.dbf
- channel ORA_DISK_1: restoring datafile 00003 to /u01/app/oracle/oradata/rcat/undotbs01.dbf
- channel ORA_DISK_1: restoring datafile 00004 to /u01/app/oracle/oradata/rcat/users01.dbf
- channel ORA_DISK_1: restoring datafile 00005 to /u01/app/oracle/oradata/rcat/example01.dbf
- channel ORA_DISK_1: restoring datafile 00006 to /u01/app/oracle/oradata/rcat/rcat01.dbf
- channel ORA_DISK_1: reading from backup piece /u01/app/oracle/flash_recovery_area/RCAT/backupset/2018_05_20/o1_mf_nnnd0_TAG20180520T201530_fj2sq2m7_.bkp
- channel ORA_DISK_1: piece handle=/u01/app/oracle/flash_recovery_area/RCAT/backupset/2018_05_20/o1_mf_nnnd0_TAG20180520T201530_fj2sq2m7_.bkp tag=TAG20180520T201530
- channel ORA_DISK_1: restored backup piece 1
- channel ORA_DISK_1: restore complete, elapsed time: 00:00:08
- Finished restore at 20-MAY-18
- RMAN> recover database;
- Starting recover at 20-MAY-18
- using channel ORA_DISK_1
- channel ORA_DISK_1: starting incremental datafile backup set restore
- channel ORA_DISK_1: specifying datafile(s) to restore from backup set
- destination for restore of datafile 00001: /u01/app/oracle/oradata/rcat/system01.dbf
- destination for restore of datafile 00002: /u01/app/oracle/oradata/rcat/sysaux01.dbf
- destination for restore of datafile 00003: /u01/app/oracle/oradata/rcat/undotbs01.dbf
- destination for restore of datafile 00004: /u01/app/oracle/oradata/rcat/users01.dbf
- destination for restore of datafile 00005: /u01/app/oracle/oradata/rcat/example01.dbf
- destination for restore of datafile 00006: /u01/app/oracle/oradata/rcat/rcat01.dbf
- channel ORA_DISK_1: reading from backup piece /u01/app/oracle/flash_recovery_area/RCAT/backupset/2018_05_20/o1_mf_nnnd1_TAG20180520T201545_fj2sqkt1_.bkp
- channel ORA_DISK_1: piece handle=/u01/app/oracle/flash_recovery_area/RCAT/backupset/2018_05_20/o1_mf_nnnd1_TAG20180520T201545_fj2sqkt1_.bkp tag=TAG20180520T201545
- channel ORA_DISK_1: restored backup piece 1
- channel ORA_DISK_1: restore complete, elapsed time: 00:00:01
- starting media recovery
- media recovery failed
- RMAN-00571: ===========================================================
- RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
- RMAN-00571: ===========================================================
- RMAN-03002: failure of recover command at 05/20/2018 20:20:25
- ORA-00283: recovery session canceled due to errors
- RMAN-11003: failure during parse/execution of SQL statement: alter database recover if needed
- start
- ORA-00283: recovery session canceled due to errors
- ORA-00313: open failed for members of log group 3 of thread 1
- ORA-00312: online log 3 thread 1: '/u01/app/oracle/oradata/rcat/redo03.log'
- ORA-27037: unable to obtain file status
- Linux-x86_64 Error: 2: No such file or directory
- Additional information: 3
- RMAN> exit
- Recovery Manager complete.
- [oracle@station90 rcat]$ sqlplus /nolog
- SQL*Plus: Release 11.2.0.1.0 Production on Sun May 20 20:21:01 2018
- Copyright (c) 1982, 2009, Oracle. All rights reserved.
- SQL> conn / as sysdba
- Connected.
- SQL> recover database until cancel;
- ORA-00279: change 1080587 generated at 05/20/2018 20:15:45 needed for thread 1
- ORA-00289: suggestion :
- /u01/app/oracle/flash_recovery_area/RCAT/archivelog/2018_05_20/o1_mf_1_9_%u_.arc
- ORA-00280: change 1080587 for thread 1 is in sequence #9
- Specify log: {<RET>=suggested | filename | AUTO | CANCEL}
- ORA-00308: cannot open archived log
- '/u01/app/oracle/flash_recovery_area/RCAT/archivelog/2018_05_20/o1_mf_1_9_%u_.ar
- c'
- ORA-27037: unable to obtain file status
- Linux-x86_64 Error: 2: No such file or directory
- Additional information: 3
- SQL> recover database until cancel;
- ORA-00279: change 1080587 generated at 05/20/2018 20:15:45 needed for thread 1
- ORA-00289: suggestion :
- /u01/app/oracle/flash_recovery_area/RCAT/archivelog/2018_05_20/o1_mf_1_9_%u_.arc
- ORA-00280: change 1080587 for thread 1 is in sequence #9
- Specify log: {<RET>=suggested | filename | AUTO | CANCEL}
- cancel
- Media recovery cancelled.
- SQL> alter database open ;
- alter database open
- *
- ERROR at line 1:
- ORA-01589: must use RESETLOGS or NORESETLOGS option for database open
- SQL> alter database open resetlogs;
- Database altered.
- SQL> alter system switch logfile;
- System altered.
- SQL> /
- System altered.
- SQL> alter system checkpoint;
- System altered.
- SQL> alter database clear logfile group 1;
- Database altered.
- SQL>
- SQL>
复制代码- select * from dba_temp_files;
- alter tablespace temp add tempfile '/u01/app/oracle/oradata/rcat/temp02.dbf'
- size 30M autoextend on;
-
- alter tablespace temp drop tempfile '/u01/app/oracle/oradata/rcat/temp01.dbf';
- alter user hr identified by oracle_4U account unlock;
- ----
- select * from v$log;
- select * from v$logfile;
- -----
- alter system checkpoint;
- alter database clear logfile group 2;
- -------------------
复制代码
|
|