分类: Oracle
2010-02-10 16:06:15
# su - oracle
$ sqlplus "/ as sysdba";
SQL*Plus: Release
Copyright (c) 1982, 2007, Oracle. All Rights Reserved.
Connected to:
Oracle Database
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL> conn system/oracle;
Connected.
SQL> create tablespace rman datafile '/oradata/jpwl/rman.dbf' size
Tablespace created.
SQL> create user rman identified by rman;
User created.
SQL> drop user rman;
User dropped.
SQL> create user rman identified by rman default tablespace rman;
User created.
SQL> grant connect,resource,recovery_catalog_owner to rman;
Grant succeeded.
SQL> exit
Disconnected from Oracle Database
With the Partitioning, OLAP, Data Mining and Real Application Testing options
$ rman catalog rman/rman;
Recovery Manager: Release
Copyright (c) 1982, 2007, Oracle. All rights reserved.
connected to recovery catalog database
RMAN> create catalog;
recovery catalog created
RMAN> register database;
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of register command at 01/05/2010 10:16:16
RMAN-06171: not connected to target database
RMAN> connect target system/oracle;
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-06004: ORACLE error from recovery catalog database: RMAN-20001: target database not found in recovery catalog
RMAN> register database;
database registered in recovery catalog
starting full resync of recovery catalog
full resync complete
RMAN> connect target system/oracle;
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-06167: already connected
RMAN> report schema;
Report of database schema
List of Permanent Datafiles
===========================
File Size(MB) Tablespace RB segs Datafile Name
---- -------- -------------------- ------- ------------------------
1 530 SYSTEM YES /oradata/jpwl/system01.dbf
2 270 UNDOTBS1 YES /oradata/jpwl/undotbs01.dbf
3 430 SYSAUX NO /oradata/jpwl/sysaux01.dbf
4 300 USERS NO /oradata/jpwl/users01.dbf
5 300 HWMS NO /oradata/jpwl/HWMS_02.DBF
6 300 HWMS NO /oradata/jpwl/HWMS_01.DBF
7 300 HWMS_INDX NO /oradata/jpwl/HWMS_INDX_02.DBF
8 300 HWMS_INDX NO /oradata/jpwl/HWMS_INDX_01.DBF
9 400 RWMS NO /oradata/jpwl/RWMS_02.DBF
10 400 RWMS NO /oradata/jpwl/RWMS_01.DBF
11 300 RWMS_B1 NO /oradata/jpwl/RWMS_B1_02.DBF
12 300 RWMS_B1 NO /oradata/jpwl/RWMS_B1_01.DBF
13 300 RWMS_INDX NO /oradata/jpwl/RWMS_INDX_02.DBF
14 300 RWMS_INDX NO /oradata/jpwl/RWMS_INDX_01.DBF
15 300 RWMS_INDX_B1 NO /oradata/jpwl/RWMS_INDX_B1_02.DBF
16 300 RWMS_INDX_B1 NO /oradata/jpwl/RWMS_INDX_B1_01.DBF
17 200 RMAN NO /oradata/jpwl/rman.dbf
List of Temporary Files
=======================
File Size(MB) Tablespace Maxsize(MB) Tempfile Name
---- -------- -------------------- ----------- --------------------
1 141 TEMP 32767 /oradata/jpwl/temp01.dbf
2 100 RWMS_TEMP 32767 /oradata/jpwl/RWMS_TEMP01.DBF
RMAN> create script backup_database{ backup database format='/backup/%u_%p.dbf' include current controlfile plus archivelog format='/backup/%u.dbf';sql 'alter system archive log current';}
created script backup_database
RMAN> run{execute script backup_database;}
executing script: backup_database
Starting backup at 05-JAN-10
current log archived
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=1075 devtype=DISK
channel ORA_DISK_1: starting archive log backupset
channel ORA_DISK_1: specifying archive log(s) in backup set
input archive log thread=1 sequence=100 recid=150 stamp=707481166
input archive log thread=1 sequence=101 recid=151 stamp=707481166
input archive log thread=1 sequence=102 recid=152 stamp=707481166
input archive log thread=1 sequence=103 recid=153 stamp=707481166
input archive log thread=1 sequence=104 recid=154 stamp=707481166
input archive log thread=1 sequence=105 recid=155 stamp=707481166
input archive log thread=1 sequence=106 recid=156 stamp=707481166
input archive log thread=1 sequence=107 recid=157 stamp=707481166
input archive log thread=1 sequence=108 recid=158 stamp=707481166
input archive log thread=1 sequence=109 recid=159 stamp=707481166
input archive log thread=1 sequence=110 recid=160 stamp=707481166
input archive log thread=1 sequence=111 recid=161 stamp=707481166
input archive log thread=1 sequence=112 recid=162 stamp=707481166
input archive log thread=1 sequence=113 recid=163 stamp=707481166
input archive log thread=1 sequence=114 recid=164 stamp=707481166
input archive log thread=1 sequence=115 recid=165 stamp=707481166
input archive log thread=1 sequence=116 recid=166 stamp=707481166
input archive log thread=1 sequence=117 recid=167 stamp=707481166
input archive log thread=1 sequence=118 recid=168 stamp=707481166
input archive log thread=1 sequence=119 recid=169 stamp=707481166
input archive log thread=1 sequence=120 recid=170 stamp=707481166
input archive log thread=1 sequence=121 recid=171 stamp=707481166
input archive log thread=1 sequence=122 recid=172 stamp=707481166
input archive log thread=1 sequence=123 recid=173 stamp=707481166
input archive log thread=1 sequence=124 recid=174 stamp=707481166
input archive log thread=1 sequence=125 recid=175 stamp=707481166
input archive log thread=1 sequence=126 recid=176 stamp=707481166
input archive log thread=1 sequence=127 recid=177 stamp=707481166
input archive log thread=1 sequence=128 recid=178 stamp=707481166
input archive log thread=1 sequence=129 recid=129 stamp=706885789
input archive log thread=1 sequence=130 recid=130 stamp=706891930
input archive log thread=1 sequence=131 recid=131 stamp=706907473
input archive log thread=1 sequence=132 recid=132 stamp=706921064
input archive log thread=1 sequence=133 recid=133 stamp=706955904
input archive log thread=1 sequence=134 recid=134 stamp=706985271
input archive log thread=1 sequence=135 recid=135 stamp=707004016
input archive log thread=1 sequence=136 recid=136 stamp=707032846
input archive log thread=1 sequence=137 recid=137 stamp=707090409
input archive log thread=1 sequence=138 recid=138 stamp=707135027
input archive log thread=1 sequence=139 recid=139 stamp=707148255
input archive log thread=1 sequence=140 recid=140 stamp=707178269
input archive log thread=1 sequence=141 recid=141 stamp=707266423
input archive log thread=1 sequence=142 recid=142 stamp=707297082
input archive log thread=1 sequence=143 recid=143 stamp=707353202
input archive log thread=1 sequence=144 recid=144 stamp=707353206
input archive log thread=1 sequence=145 recid=145 stamp=707408714
input archive log thread=1 sequence=146 recid=146 stamp=707437095
input archive log thread=1 sequence=147 recid=147 stamp=707474370
input archive log thread=1 sequence=148 recid=148 stamp=707474436
input archive log thread=1 sequence=149 recid=149 stamp=707481164
channel ORA_DISK_1: starting piece 1 at 05-JAN-10
channel ORA_DISK_1: finished piece 1 at 05-JAN-10
piece handle=/backup/
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:46
Finished backup at 05-JAN-10
Starting backup at 05-JAN-10
using channel ORA_DISK_1
channel ORA_DISK_1: starting full datafile backupset
channel ORA_DISK_1: specifying datafile(s) in backupset
input datafile fno=00001 name=/oradata/jpwl/system01.dbf
input datafile fno=00003 name=/oradata/jpwl/sysaux01.dbf
input datafile fno=00009 name=/oradata/jpwl/RWMS_02.DBF
input datafile fno=00010 name=/oradata/jpwl/RWMS_01.DBF
input datafile fno=00004 name=/oradata/jpwl/users01.dbf
input datafile fno=00005 name=/oradata/jpwl/HWMS_02.DBF
input datafile fno=00006 name=/oradata/jpwl/HWMS_01.DBF
input datafile fno=00007 name=/oradata/jpwl/HWMS_INDX_02.DBF
input datafile fno=00008 name=/oradata/jpwl/HWMS_INDX_01.DBF
input datafile fno=00011 name=/oradata/jpwl/RWMS_B1_02.DBF
input datafile fno=00012 name=/oradata/jpwl/RWMS_B1_01.DBF
input datafile fno=00013 name=/oradata/jpwl/RWMS_INDX_02.DBF
input datafile fno=00014 name=/oradata/jpwl/RWMS_INDX_01.DBF
input datafile fno=00015 name=/oradata/jpwl/RWMS_INDX_B1_02.DBF
input datafile fno=00016 name=/oradata/jpwl/RWMS_INDX_B1_01.DBF
input datafile fno=00002 name=/oradata/jpwl/undotbs01.dbf
input datafile fno=00017 name=/oradata/jpwl/rman.dbf
channel ORA_DISK_1: starting piece 1 at 05-JAN-10
channel ORA_DISK_1: finished piece 1 at 05-JAN-10
piece handle=/backup/
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:26
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 05-JAN-10
channel ORA_DISK_1: finished piece 1 at 05-JAN-10
piece handle=/backup/
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:02
Finished backup at 05-JAN-10
Starting backup at 05-JAN-10
current log archived
using channel ORA_DISK_1
channel ORA_DISK_1: starting archive log backupset
channel ORA_DISK_1: specifying archive log(s) in backup set
input archive log thread=1 sequence=150 recid=179 stamp=707481240
channel ORA_DISK_1: starting piece 1 at 05-JAN-10
channel ORA_DISK_1: finished piece 1 at 05-JAN-10
piece handle=/backup/
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:02
Finished backup at 05-JAN-10
sql statement: alter system archive log current
RMAN> print script backup_database;
printing stored script: backup_database
{ backup database format='/backup/%u_%p.dbf' include current controlfile plus archivelog format='/backup/%u.dbf';sql 'alter system archive log current';}
RMAN> list script names;
List of Stored Scripts in Recovery Catalog
Scripts of Target Database JPWL
Script Name
Description
-----------------------------------------------------------------------
backup_database
# df –g
/dev/backuplv 97.50 86.20 12% 13 1% /backup
/dev/oradata 100.00 91.21 9% 4593 1% /oradata
Filesystem GB blocks Free %Used Iused %Iused Mounted on
/dev/hd4 10.00 9.91 1% 6557 1% /
/dev/hd2 4.00 2.02 50% 43486 9% /usr
/dev/hd9var 1.00 0.60 41% 7474 6% /var
/dev/hd3 1.00 0.67 34% 831 1% /tmp
/dev/hd1 1.00 1.00 1% 12 1% /home
/proc - - - - - /proc
/dev/hd10opt 0.50 0.20 60% 9852 17% /opt
/dev/oraclelv 20.00 15.71 22% 19271 1% /oracle
/dev/archivelv 100.00 87.41 13% 152 1% /archive
/dev/backuplv 97.50 91.81 6% 9 1% /backup
/dev/oradata 100.00 91.42 9% 4592 1% /oradata
Filesystem GB blocks Free %Used Iused %Iused Mounted on
/dev/hd4 10.00 9.91 1% 6557 1% /
/dev/hd2 4.00 2.02 50% 43486 9% /usr
/dev/hd9var 1.00 0.60 41% 7474 6% /var
/dev/hd3 1.00 0.67 34% 831 1% /tmp
/dev/hd1 1.00 1.00 1% 12 1% /home
/proc - - - - - /proc
/dev/hd10opt 0.50 0.20 60% 9852 17% /opt
/dev/oraclelv 20.00 15.71 22% 19293 1% /oracle
/dev/archivelv 100.00 87.37 13% 155 1% /archive
/dev/backuplv 97.50 86.20 12% 13 1% /backup
/dev/oradata 100.00 91.21 9% 4593 1% /oradata
Filesystem GB blocks Free %Used Iused %Iused Mounted on
/dev/hd4 10.00 9.91 1% 6557 1% /
/dev/hd2 4.00 2.02 50% 43486 9% /usr
/dev/hd9var 1.00 0.60 41% 7474 6% /var
/dev/hd3 1.00 0.67 34% 831 1% /tmp
/dev/hd1 1.00 1.00 1% 12 1% /home
/proc - - - - - /proc
/dev/hd10opt 0.50 0.20 60% 9852 17% /opt
/dev/oraclelv 20.00 15.71 22% 19293 1% /oracle
/dev/archivelv 100.00 87.37 13% 155 1% /archive
/dev/backuplv 97.50 91.81 6% 9 1% /backup
/dev/oradata 100.00 91.21 9% 4593 1% /oradata
# su - oracle
$ rman catalog rman/rman
Recovery Manager: Release
Copyright (c) 1982, 2007, Oracle. All rights reserved.
connected to recovery catalog database
RMAN> connect target system/oracle
connected to target database: JPWL (DBID=477764098)
$ rman target system/oracle
Recovery Manager: Release
Copyright (c) 1982, 2007, Oracle. All rights reserved.
connected to target database: JPWL (DBID=477764098)
RMAN> connect catalog rman/rman
connected to recovery catalog database