50.恢复目录在生产环境中的应用
1.恢复目录
[oracle@yuanzj.com:/home/oracle]$ sas
SQL*Plus: Release 10.2.0.5.0 - Production on Sun Mar 5 17:55:40 2023
Copyright (c) 1982, 2010, Oracle. All Rights Reserved.
Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 - 64bit Production
With the Partitioning, Oracle Label Security, OLAP, Data Mining Scoring Engine
and Real Application Testing options
sys@ORCL10G 2023-03-05 17:55:40> create tablespace catadb datafile '/oradata/orcl10g/catadb01.dbf' size 100m autoextend on maxsize 30720m
2 ;
Tablespace created.
Elapsed: 00:00:00.77
sys@ORCL10G 2023-03-05 17:56:33> create user catau identified by catau123 default tablespace catadb;
User created.
Elapsed: 00:00:00.01
sys@ORCL10G 2023-03-05 17:57:03> grant connect,resource to catau;
Grant succeeded.
Elapsed: 00:00:00.01
sys@ORCL10G 2023-03-05 17:57:19> quit
Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 - 64bit Production
With the Partitioning, Oracle Label Security, OLAP, Data Mining Scoring Engine
and Real Application Testing options
[oracle@yuanzj.com:/home/oracle]$ sas
SQL*Plus: Release 10.2.0.5.0 - Production on Sun Mar 5 17:57:45 2023
Copyright (c) 1982, 2010, Oracle. All Rights Reserved.
Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 - 64bit Production
With the Partitioning, Oracle Label Security, OLAP, Data Mining Scoring Engine
and Real Application Testing options
sys@ORCL10G 2023-03-05 17:57:45> grant recovery_catalog_owner to catau;
Grant succeeded.
Elapsed: 00:00:00.00
sys@ORCL10G 2023-03-05 17:58:07> quit
Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 - 64bit Production
With the Partitioning, Oracle Label Security, OLAP, Data Mining Scoring Engine
and Real Application Testing options
[oracle@yuanzj.com:/home/oracle]$ rman target / catalog catau/catau123
Recovery Manager: Release 10.2.0.5.0 - Production on Sun Mar 5 17:58:36 2023
Copyright (c) 1982, 2007, Oracle. All rights reserved.
connected to target database: ORCL10G (DBID=1313046744)
connected to recovery catalog database
RMAN> create catalog;
recovery catalog created
RMAN> register database;
database registered in recovery catalog
starting full resync of recovery catalog
full resync complete
RMAN> list backup;
RMAN> backup database;
Starting backup at 2023-03-05 18:03:34
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=141 devtype=DISK
channel ORA_DISK_1: starting full datafile backupset
channel ORA_DISK_1: specifying datafile(s) in backupset
input datafile fno=00001 name=/oradata/orcl10g/system01.dbf
input datafile fno=00003 name=/oradata/orcl10g/sysaux01.dbf
input datafile fno=00005 name=/oradata/orcl10g/example01.dbf
input datafile fno=00006 name=/oradata/orcl10g/catadb01.dbf
input datafile fno=00002 name=/oradata/orcl10g/undotbs01.dbf
input datafile fno=00004 name=/oradata/orcl10g/users01.dbf
channel ORA_DISK_1: starting piece 1 at 2023-03-05 18:03:35
channel ORA_DISK_1: finished piece 1 at 2023-03-05 18:03:50
piece handle=/u01/app/ora10g/flash_recovery_area/ORCL10G/backupset/2023_03_05/o1_mf_nnndf_TAG20230305T180335_l08t7qt8_.bkp tag=TAG20230305T180335 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:15
channel ORA_DISK_1: starting full datafile backupset
channel ORA_DISK_1: specifying datafile(s) in backupset
including current control file in backupset
including current SPFILE in backupset
channel ORA_DISK_1: starting piece 1 at 2023-03-05 18:03:51
channel ORA_DISK_1: finished piece 1 at 2023-03-05 18:03:52
piece handle=/u01/app/ora10g/flash_recovery_area/ORCL10G/backupset/2023_03_05/o1_mf_ncsnf_TAG20230305T180335_l08t87dp_.bkp tag=TAG20230305T180335 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:02
Finished backup at 2023-03-05 18:03:52
RMAN> unregister database;
database name is "ORCL10G" and DBID is 1313046744
Do you really want to unregister the database (enter YES or NO)? YES
database unregistered from the recovery catalog