bash-3.00$ export ORACLE_SID=newly ---rman catalog库
bash-3.00$ sqlplus '/as sysdba'
SQL*Plus: Release 10.2.0.2.0 - Production on Sat Sep 19 13:18:24 2009
Copyright (c) 1982, 2005, Oracle. All Rights Reserved.
???:
Oracle Database 10g Enterprise Edition Release 10.2.0.2.0 - Production
With the Partitioning, OLAP and Data Mining options
SQL> show parameter db_na
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
db_name string newly
SQL> alter session set nls_language=american;
Session altered.
SQL> create tablespace cattbs datafile '/oracle/newly/cattbs.dbf' size 500m;--创建一个rman catalog用户对应存储的表空间
Tablespace created.
SQL> create user rman identified by system default tablespace cattbs quota unlimited on cattbs;--创建一个rman catalog用户
User created.
SQL> grant recovery_catalog_owner to rman;--给rman catalog用户授权,非常重要,必须要
Grant succeeded.
SQL> exit
bash-3.00$ rman target "sys/system@ora10g" catalog rman/system@newly --利用rman同时连接目标库(备份目标库)及rman catalog库
Recovery Manager: Release 10.2.0.2.0 - Production on Sat Sep 19 13:38:21 2009
Copyright (c) 1982, 2005, Oracle. All rights reserved.
connected to target database: ORA10G (DBID=4016423416)
connected to recovery catalog database
RMAN> create script. backup_db --在rman catalog中构建脚本
2> comment 'backup db and logs'
3> {
4> backup incremental level 0 tag incr_whole_10
5> database plus archivelog;
6> }
created script. backup_db
RMAN> create global script. global_backup_db
2> comment 'backup any database from the recovery catalog and logs'
3> { backup database plus archivelog;}
created global script. global_backup_db
RMAN> create script. backup_db
2> comment 'backup db and logs'
3> {
4> backup incremental level 0 tag incr_whole_10
5> database plus archivelog;
6> }
created script. backup_db
RMAN> print script. backup_db; --显示脚本
printing stored script. backup_db
{backup database plus archivelog;
}
RMAN> print script. backup_db to file '/oracle/newly/output.rman';---把指定的脚本导向到指定的文件
script. backup_db written to file /oracle/newly/output.rman
RMAN> replace script. backup_db --更新脚本
2> comment 'run this to back up the db'
3> {
4> #uses configured channel for default device type
5> backup database;
6> }
replaced script. backup_db
RMAN> replace script. backup_db from file '/oracle/newly/output.rman'; ---以指定的文件更新脚本
script. commands will be loaded from file /oracle/newly/output.rman
replaced script. backup_db
RMAN> run ---执行脚本,必须在run块中
2> {
3> execute script. backup_db;
4> }
executing script. backup_db
Starting backup at 19-SEP-09
current log archived
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=138 devtype=DISK
channel ORA_DISK_1: starting compressed archive log backupset
channel ORA_DISK_1: specifying archive log(s) in backup set
input archive log thread=1 sequence=2 recid=18 stamp=697895462
input archive log thread=1 sequence=3 recid=19 stamp=697895462
input archive log thread=1 sequence=4 recid=20 stamp=697895462
input archive log thread=1 sequence=5 recid=21 stamp=697895462
input archive log thread=1 sequence=6 recid=17 stamp=697895461
channel ORA_DISK_1: starting piece 1 at 19-SEP-09
channel ORA_DISK_1: finished piece 1 at 19-SEP-09
piece handle=/oracle/auto/backup_3hkpkv3k_1_1 tag=TAG20090919T141059 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:26
channel ORA_DISK_1: starting compressed archive log backupset
channel ORA_DISK_1: specifying archive log(s) in backup set
input archive log thread=1 sequence=12 recid=15 stamp=697892624
input archive log thread=1 sequence=13 recid=16 stamp=697893507
input archive log thread=1 sequence=14 recid=22 stamp=697985490
input archive log thread=1 sequence=15 recid=23 stamp=697990254
channel ORA_DISK_1: starting piece 1 at 19-SEP-09
channel ORA_DISK_1: finished piece 1 at 19-SEP-09
piece handle=/oracle/auto/backup_3ikpkv4f_1_1 tag=TAG20090919T141059 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:08
Finished backup at 19-SEP-09
Starting backup at 19-SEP-09
using channel ORA_DISK_1
channel ORA_DISK_1: starting compressed full datafile backupset
channel ORA_DISK_1: specifying datafile(s) in backupset
input datafile fno=00001 name=/oracle/oradata/ora10g/system01.dbf
input datafile fno=00003 name=/oracle/oradata/ora10g/sysaux01.dbf
input datafile fno=00005 name=/oracle/zxy.dbf
input datafile fno=00002 name=/oracle/oradata/ora10g/undotbs01.dbf
input datafile fno=00004 name=/oracle/oradata/ora10g/users01.dbf
channel ORA_DISK_1: starting piece 1 at 19-SEP-09
channel ORA_DISK_1: finished piece 1 at 19-SEP-09
piece handle=/oracle/auto/backup_3jkpkv4o_1_1 tag=TAG20090919T141136 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:01:05
Finished backup at 19-SEP-09
Starting backup at 19-SEP-09
current log archived
using channel ORA_DISK_1
channel ORA_DISK_1: starting compressed archive log backupset
channel ORA_DISK_1: specifying archive log(s) in backup set
input archive log thread=1 sequence=16 recid=24 stamp=697990364
channel ORA_DISK_1: starting piece 1 at 19-SEP-09
channel ORA_DISK_1: finished piece 1 at 19-SEP-09
piece handle=/oracle/auto/backup_3kkpkv6u_1_1 tag=TAG20090919T141246 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 19-SEP-09
Starting Control File and SPFILE Autobackup at 19-SEP-09
piece handle=/oracle/c-4016423416-20090919-00 comment=NONE
Finished Control File and SPFILE Autobackup at 19-SEP-09
RMAN>
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/9240380/viewspace-615033/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/9240380/viewspace-615033/