1,rman可连接三种数据库
target database
recovery catalog database
auxiliary database
2,非catalog方式
全备份, 0级增量备份, 1级增量备份
3,find / -name rman
用这个命令找一下根目录中的rman
如果linux中 /usr/.../bin/rman 在第一条,而/u01/oracle.../bin/rman在第二条
那条默认是linux的系统rman而不是oracle的rman,这个时候,可以去oracle的环境变量中,
su 到oracle用户中, 然后用vi ./.bash_profile中,将PATH中的$PATH与
$ORACLE_HOME/PATH 进行互换,然后exit一下,再su到oracle用户中。
用echo $PATH查看顺序。
4,确认database是archive log模式。
conn /as sysdba 进入到数据库中.
用 archive log list查看是不是archive mode 并且是enable状态
如果是no archive log模式,可以将数据库start mount状态,然后alter database
archivelog 将数据库切到archive log 模式.
5,条件具备后,进入oracle用户,输入 rman nocatalog
连接到target database 用 connect target / 命令连到target database
然后list backupset 命令查看是不是曾经备份过.
然后用backup database 全备数据库。
6,经过一段时间后,备份完成。
进入ls /u01/flash_recovery_area..../backupset -lh查看一下
[root@oracle11g ~]# find / -name rman
/u01/oracle/bin/rman
/u01/oracle/sysman/admin/scripts/db/rman
/u01/oracle/oc4j/j2ee/oc4j_applications/applications/em/em/WEB-INF/perl/db/rman
[root@oracle11g ~]# su - oracle
[oracle@oracle11g ~]$ echo $path
[oracle@oracle11g ~]$ echo $PATH
/u01/oracle/bin:/usr/kerberos/bin:/usr/local/bin:/bin:/usr/bin:/usr/X11R6/bin:/u01/oracle/bin
[oracle@oracle11g ~]$ sqlplus /nolog
SQL*Plus: Release 11.2.0.1.0 Production on Sat Apr 14 19:52:05 2012
Copyright (c) 1982, 2009, Oracle. All rights reserved.
SQL> conn /as sysdba
Connected to an idle instance.
SQL> startup
ORACLE instance started.
Total System Global Area 619360256 bytes
Fixed Size 1338280 bytes
Variable Size 394265688 bytes
Database Buffers 218103808 bytes
Redo Buffers 5652480 bytes
Database mounted.
Database opened.
SQL> archive log list
Database log mode No Archive Mode
Automatic archival Disabled
Archive destination USE_DB_RECOVERY_FILE_DEST
Oldest online log sequence 10
Current log sequence 12
SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup mount
ORACLE instance started.
Total System Global Area 619360256 bytes
Fixed Size 1338280 bytes
Variable Size 394265688 bytes
Database Buffers 218103808 bytes
Redo Buffers 5652480 bytes
Database mounted.
SQL> alter database archivelog
2 ;
Database altered.
SQL> alter database open;
Database altered.
SQL> archive log list;
Database log mode Archive Mode
Automatic archival Enabled
Archive destination USE_DB_RECOVERY_FILE_DEST
Oldest online log sequence 10
Next log sequence to archive 12
Current log sequence 12
SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup
ORACLE instance started.
Total System Global Area 619360256 bytes
Fixed Size 1338280 bytes
Variable Size 394265688 bytes
Database Buffers 218103808 bytes
Redo Buffers 5652480 bytes
Database mounted.
Database opened.
SQL> archive log list
Database log mode Archive Mode
Automatic archival Enabled
Archive destination USE_DB_RECOVERY_FILE_DEST
Oldest online log sequence 10
Next log sequence to archive 12
Current log sequence 12
SQL> quit;
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
[oracle@oracle11g ~]$ rman
Recovery Manager: Release 11.2.0.1.0 - Production on Sat Apr 14 19:58:31 2012
Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.
RMAN> quit
Recovery Manager complete.
[oracle@oracle11g ~]$ rman nocatalog
Recovery Manager: Release 11.2.0.1.0 - Production on Sat Apr 14 19:58:46 2012
Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.
RMAN> list backupset;
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of list command at 04/14/2012 19:58:58
RMAN-06171: not connected to target database
RMAN> connect target /
connected to target database: SSM (DBID=1711362819)
using target database control file instead of recovery catalog
RMAN> list backupset;
specification does not match any backup in the repository
RMAN> backup database;
Starting backup at 14-APR-12
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=37 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/oradata/ssm/system01.dbf
input datafile file number=00002 name=/u01/oradata/ssm/sysaux01.dbf
input datafile file number=00005 name=/u01/oradata/ssm/example01.dbf
input datafile file number=00003 name=/u01/oradata/ssm/undotbs01.dbf
input datafile file number=00004 name=/u01/oradata/ssm/users01.dbf
channel ORA_DISK_1: starting piece 1 at 14-APR-12
channel ORA_DISK_1: finished piece 1 at 14-APR-12
piece handle=/u01/flash_recovery_area/SSM/backupset/2012_04_14/o1_mf_nnndf_TAG20120414T200131_7rn3yvvj_.bkp tag=TAG20120414T200131 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:04:16
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
including current control file in backup set
including current SPFILE in backup set
channel ORA_DISK_1: starting piece 1 at 14-APR-12
channel ORA_DISK_1: finished piece 1 at 14-APR-12
piece handle=/u01/flash_recovery_area/SSM/backupset/2012_04_14/o1_mf_ncsnf_TAG20120414T200131_7rn46z0y_.bkp tag=TAG20120414T200131 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 14-APR-12
RMAN> list backupset
2> ;
List of Backup Sets
===================
BS Key Type LV Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
1 Full 1.03G DISK 00:04:08 14-APR-12
BP Key: 1 Status: AVAILABLE Compressed: NO Tag: TAG20120414T200131
Piece Name: /u01/flash_recovery_area/SSM/backupset/2012_04_14/o1_mf_nnndf_TAG20120414T200131_7rn3yvvj_.bkp
List of Datafiles in backup set 1
File LV Type Ckp SCN Ckp Time Name
---- -- ---- ---------- --------- ----
1 Full 973546 14-APR-12 /u01/oradata/ssm/system01.dbf
2 Full 973546 14-APR-12 /u01/oradata/ssm/sysaux01.dbf
3 Full 973546 14-APR-12 /u01/oradata/ssm/undotbs01.dbf
4 Full 973546 14-APR-12 /u01/oradata/ssm/users01.dbf
5 Full 973546 14-APR-12 /u01/oradata/ssm/example01.dbf
BS Key Type LV Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
2 Full 9.36M DISK 00:00:04 14-APR-12
BP Key: 2 Status: AVAILABLE Compressed: NO Tag: TAG20120414T200131
Piece Name: /u01/flash_recovery_area/SSM/backupset/2012_04_14/o1_mf_ncsnf_TAG20120414T200131_7rn46z0y_.bkp
SPFILE Included: Modification time: 14-APR-12
SPFILE db_unique_name: SSM
Control File Included: Ckp SCN: 973642 Ckp time: 14-APR-12
RMAN> quit
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/26816308/viewspace-721197/
,如需转载,请注明出处,否则将追究法律责任。