oracle10g_rman_語法測試_5

wisdomone1發表於2009-09-19

 


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/,如需轉載,請註明出處,否則將追究法律責任。

相關文章