傻瓜式实战Oracle10g RMAN之数据库备份和恢复之catalog模式
1、创建tablespace
SQL> col name format a60 SQL> set line 200 SQL> select name,status from v$datafile; NAME STATUS ------------------------------------------------------------ ------- /u01/app/oracle/oradata/testdb/system01.dbf SYSTEM /u01/app/oracle/oradata/testdb/sysaux01.dbf ONLINE /u01/app/oracle/oradata/testdb/undotbs01.dbf ONLINE /u01/app/oracle/oradata/testdb/users01.dbf ONLINE /u01/app/oracle/oradata/testdb/example01.dbf ONLINE /u01/app/oracle/oradata/testdb/DATACENTER01.dbf ONLINE 6 rows selected. SQL> create tablespace rman_ts datafile '/u01/app/oracle/oradata/testdb/rman_ts01.dbf' size 200M; Tablespace created. SQL> select name,status from v$datafile; NAME STATUS ------------------------------------------------------------ ------- /u01/app/oracle/oradata/testdb/system01.dbf SYSTEM /u01/app/oracle/oradata/testdb/sysaux01.dbf ONLINE /u01/app/oracle/oradata/testdb/undotbs01.dbf ONLINE /u01/app/oracle/oradata/testdb/users01.dbf ONLINE /u01/app/oracle/oradata/testdb/example01.dbf ONLINE /u01/app/oracle/oradata/testdb/DATACENTER01.dbf ONLINE /u01/app/oracle/oradata/testdb/rman_ts01.dbf ONLINE 7 rows selected. SQL> show user USER is "SYS"
2、创建用户rman并授权
SQL> show user USER is "SYS" SQL> create user rman identified by rman default tablespace rman_ts quota unlimited on rman_ts; User created. SQL> grant recovery_catalog_owner to rman; Grant succeeded. SQL> grant connect to rman; Grant succeeded. SQL> exit Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production With the Partitioning, OLAP, Data Mining and Real Application Testing options
3、rman连接目录数据库并完成register
11203ora-> rman catalog rman/rman Recovery Manager: Release 11.2.0.3.0 - Production on Sat Jul 13 07:36:45 2013 Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved. connected to recovery catalog database RMAN> create catalog tablespace rman_ts; recovery catalog created RMAN> connect target / connected to target database: TESTDB (DBID=2603690985) RMAN> register database; database registered in recovery catalog starting full resync of recovery catalog full resync complete RMAN> quit Recovery Manager complete.
4、rman连接目标数据库及目录数据库,完成一次全备
11203ora-> rman target / catalog rman/rman Recovery Manager: Release 11.2.0.3.0 - Production on Sat Jul 13 07:42:12 2013 Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved. connected to target database: TESTDB (DBID=2603690985) connected to recovery catalog database RMAN> backup format '/home/oracle/RmanBackup/Full_%T_%t.bak' database; Starting backup at 2013/07/13 07:44:05 allocated channel: ORA_DISK_1 channel ORA_DISK_1: SID=143 device type=DISK channel ORA_DISK_1: starting full datafile backup set channel ORA_DISK_1: specifying datafile(s) in backup set input datafile file number=00001 name=/u01/app/oracle/oradata/testdb/system01.dbf input datafile file number=00002 name=/u01/app/oracle/oradata/testdb/sysaux01.dbf input datafile file number=00005 name=/u01/app/oracle/oradata/testdb/example01.dbf input datafile file number=00006 name=/u01/app/oracle/oradata/testdb/DATACENTER01.dbf input datafile file number=00007 name=/u01/app/oracle/oradata/testdb/rman_ts01.dbf input datafile file number=00003 name=/u01/app/oracle/oradata/testdb/undotbs01.dbf input datafile file number=00004 name=/u01/app/oracle/oradata/testdb/users01.dbf channel ORA_DISK_1: starting piece 1 at 2013/07/13 07:44:07 channel ORA_DISK_1: finished piece 1 at 2013/07/13 07:44:52 piece handle=/home/oracle/RmanBackup/Full_20130713_820655047.bak tag=TAG20130713T074406 comment=NONE channel ORA_DISK_1: backup set complete, elapsed time: 00:00:45 Finished backup at 2013/07/13 07:44:52 Starting Control File and SPFILE Autobackup at 2013/07/13 07:44:52 piece handle=/u01/app/oracle/fast_recovery_area/TESTDB/autobackup/2013_07_13/o1_mf_s_820655093_8y157ofk_.bkp comment=NONE Finished Control File and SPFILE Autobackup at 2013/07/13 07:44:54 RMAN>