1)创建脚本(replace 是修改已经存在的脚本)
RMAN> create script users_bak {
2> backup datafile '/u01/app/oracle/oradata/prod/users01.dbf' format '/disk1/rman/prod/users_%s.bak';
3> }
created script users_bak
2)查看脚本信息
RMAN> print script users_bak;
printing stored script: users_bak
{backup datafile '/u01/app/oracle/oradata/prod/users01.dbf' format '/disk1/rman/prod/users_%s.bak';
}
------通过catalog database 查看
03:02:45 SQL> col SCRIPT_NAME for a30
03:02:54 SQL> col SCRIPT_COMMENT for a50
03:03:01 SQL>
1* select * from RC_STORED_SCRIPT
DB_KEY DB_NAME SCRIPT_NAME SCRIPT_COMMENT
---------- -------- ------------------------------ --------------------------------------------------
1 PROD users_bak
03:03:23 SQL> col text for a50
03:03:30 SQL>
1* select * from RC_STORED_SCRIPT_LINE
DB_KEY SCRIPT_NAME LINE TEXT
---------- ------------------------------ ---------- --------------------------------------------------
1 users_bak 1 {backup datafile '/u01/app/oracle/oradata/prod/us
ers01.dbf' format '/disk1/rman/prod/users_%s.bak';
1 users_bak 2 }
3)运行脚本
RMAN> run { execute script users_bak;}
4) 删除脚本
RMAN> delete script users_bak;
deleted script: users_bak
oracle视频教程请关注:http://u.youku.com/user_video/id_UMzAzMjkxMjE2.html
转载于:https://blog.51cto.com/19880614/1224865