直接启动rman
% rman
Start the RMAN executable at the operating system command line while connecting to a target database and, possibly, a recovery catalog, as in the following examples:
% rman TARGET / # operating system authentication
| [oracle@localhost ~]$ rman TARGET / Recovery Manager: Release 10.2.0.1.0 - Production on Fri Sep 10 10:56:29 2010 Copyright (c) 1982, 2005, Oracle. All rights reserved. connected to target database: T1DB (DBID=139407305) RMAN> |
% rman TARGET SYS@prod NOCATALOG # RMAN prompts for SYS password
| [oracle@localhost ~]$ rman target sys/123@t1db nocatalog Recovery Manager: Release 10.2.0.1.0 - Production on Fri Sep 10 10:57:47 2010 Copyright (c) 1982, 2005, Oracle. All rights reserved. connected to target database: T1DB (DBID=139407305) using target database control file instead of recovery catalog RMAN> |
% rman TARGET / CATALOG rco@catdb # RMAN prompts for rco password
% rman LOG /tmp/rman.log or % rman | tee rman.log
If you are going to use RMAN to connect to an unmounted database and mount the database later while RMAN is still connected, then set the
NLS_LANG environment variable so that it also specifies the character
set used by the database.
rman连接一个unmount状态的数据库,设置了NLS_LANG将对数据库
mount之后的状态起作用
A database that is not mounted assumes the default character set,
which is US7ASCII. If your character set is different from the default,
then RMAN returns errors after the database is mounted.
数据库再unmount状态下默认字符集是US7ASCII.如果你数据库的字符集
不一样,就会报错。这就是设置NLS_LANG环境变量的原因
NLS_LANG=american NLS_DATE_FORMAT='Mon DD YYYY HH24:MI:SS'
RMAN> BACKUP DATABASE 2> INCLUDE CURRENT 3> CONTROLFILE 4> ; |
% rman TARGET / @cmdfile1 |
RMAN> @cmdfile1 |
To create and use a dynamic shell script.:
Create an RMAN command file that uses substitution variables.
The following example shows the contents of a command file named quarterly_backup.cmd, which is run every quarter. The script. uses substitution variables for the name of the tape set, for a string in the FORMAT specification, and for the name of the restore point to be created.
# quarterly_backup.cmd CONNECT TARGET / RUN { ALLOCATE CHANNEL c1 DEVICE TYPE sbt PARMS 'ENV=(OB_MEDIA_FAMILY=&1)'; BACKUP DATABASE TAG &2 FORMAT '/disk2/bck/&1%U.bck' KEEP FOREVER RESTORE POINT &3; } EXIT;Create a shell script. that you can use to run the RMAN command file created in the previous step.
The following example creates a shell script. named runbackup.sh. The example creates shell variables for the format and restore point name and accepts the values for these variables as command-line arguments to the script.
#!/bin/tcsh # name: runbackup.sh # usage: use the tag name and number of copies as arguments set media_family = $argv[1] set format = $argv[2]set restore_point = $argv[3] rman @'/disk1/scripts/whole_db.cmd' USING $media_family $format $restore_point
Execute the shell script. created in the previous step, specifying the desired arguments on the command line.
The following example runs the runbackup.sh shell script. and passes it archival_backup as the media family name, bck0906 as the format string, and FY06Q3 as the restore point name.
% runbackup.sh archival_backup bck0906 FY06Q3
% rman CHECKSYNTAX |
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/24419958/viewspace-673125/ ,如需转载,请注明出处,否则将追究法律责任。