oracle rman 脚本还原,Oracle 的Rman 极速还原备份 自用脚本

shutdown immediate;

startup nomount;

restore controlfile from 'D:\dbback\ .CTL';

alter database mount;

CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK clear;

CONFIGURE CHANNEL DEVICE TYPE DISK clear;

catalog start with 'D:\dbback';

YES

crosscheck backup;

delete expired backup ;

YES

crosscheck copy;

delete expired copy;

YES

crosscheck archivelog all;

delete expired archivelog all;

YES

report schema;

run {

set newname for datafile 1 to 'D:\app\Administrator\oradata\YMS\SYSTEM01.DBF';

set newname for datafile 2 to 'D:\app\Administrator\oradata\YMS\SYSAUX01.DBF';

set newname for datafile 3 to 'D:\app\Administrator\oradata\YMS\UNDOTBS01.DBF';

set newname for datafile 4 to 'D:\app\Administrator\oradata\YMS\USERS01.DBF';

set newname for datafile 5 to 'D:\app\Administrator\oradata\YMS\UNDOTBS02.DBF';

set newname for datafile 6 to 'D:\app\Administrator\oradata\YMS\SYSTEM02.DBF';

set newname for datafile 7 to 'D:\app\Administrator\oradata\YMS\SYSTEM03.DBF';

set newname for datafile 8 to 'D:\app\Administrator\oradata\YMS\SYSAUX02.DBF';

set newname for datafile 9 to 'D:\app\Administrator\oradata\YMS\YMS_DATA01.DBF';

set newname for datafile 10 to 'D:\app\Administrator\oradata\YMS\YMS_DATA02.DBF';

set newname for datafile 11 to 'D:\app\Administrator\oradata\YMS\YMS_DATA03.DBF';

set newname for datafile 12 to 'D:\app\Administrator\oradata\YMS\YMS_IDX01.DBF';

set newname for datafile 13 to 'D:\app\Administrator\oradata\YMS\YMS_IDX02.DBF';

set newname for datafile 14 to 'D:\app\Administrator\oradata\YMS\YMS_DATA04.DBF';

set newname for datafile 15 to 'D:\app\Administrator\oradata\YMS\YMS_DATA05.DBF';

set newname for datafile 16 to 'D:\app\Administrator\oradata\YMS\YMS_DATA06.DBF';

set newname for datafile 17 to 'D:\app\Administrator\oradata\YMS\YMS_DATA07.DBF';

set newname for datafile 18 to 'D:\app\Administrator\oradata\YMS\YMS_DATA08.DBF';

set newname for datafile 19 to 'D:\app\Administrator\oradata\YMS\YMS_DATA09.DBF';

restore database;

switch datafile all;

}

recover database;

--sqlplus:

alter database noarchivelog;

alter system set sessions=1000 scope=spfile;

alter database rename file 'M:\ORADATA\YMS\REDO01.LOG' to 'D:\app\Administrator\oradata\YMS\REDO01.LOG';

alter database rename file 'M:\ORADATA\YMS\REDO02.LOG' to 'D:\app\Administrator\oradata\YMS\REDO02.LOG';

alter database rename file 'M:\ORADATA\YMS\REDO03.LOG' to 'D:\app\Administrator\oradata\YMS\REDO03.LOG';

alter database rename file 'M:\ORADATA\YMS\REDO04.LOG' to 'D:\app\Administrator\oradata\YMS\REDO04.LOG';

alter database rename file 'M:\ORADATA\YMS\REDO05.LOG' to 'D:\app\Administrator\oradata\YMS\REDO05.LOG';

alter database rename file 'M:\ORADATA\YMS\REDO06.LOG' to 'D:\app\Administrator\oradata\YMS\REDO06.LOG';

alter database rename file 'M:\ORADATA\YMS\REDO07.LOG' to 'D:\app\Administrator\oradata\YMS\REDO07.LOG';

alter database rename file 'M:\ORADATA\YMS\REDO08.LOG' to 'D:\app\Administrator\oradata\YMS\REDO08.LOG';

alter database rename file 'M:\ORADATA\YMS\REDO08.LOG' to 'D:\app\Administrator\oradata\YMS\REDO09.LOG';

alter database rename file 'M:\ORADATA\YMS\REDO01B.LOG' to 'D:\app\Administrator\oradata\YMS\REDO01B.LOG';

alter database rename file 'M:\ORADATA\YMS\REDO02B.LOG' to 'D:\app\Administrator\oradata\YMS\REDO02B.LOG';

alter database rename file 'M:\ORADATA\YMS\REDO03B.LOG' to 'D:\app\Administrator\oradata\YMS\REDO03B.LOG';

alter database rename file 'M:\ORADATA\YMS\REDO04B.LOG' to 'D:\app\Administrator\oradata\YMS\REDO04B.LOG';

alter database rename file 'M:\ORADATA\YMS\REDO05B.LOG' to 'D:\app\Administrator\oradata\YMS\REDO05B.LOG';

alter database rename file 'M:\ORADATA\YMS\REDO06B.LOG' to 'D:\app\Administrator\oradata\YMS\REDO06B.LOG';

alter database rename file 'M:\ORADATA\YMS\REDO07B.LOG' to 'D:\app\Administrator\oradata\YMS\REDO07B.LOG';

alter database rename file 'M:\ORADATA\YMS\REDO08B.LOG' to 'D:\app\Administrator\oradata\YMS\REDO08B.LOG';

alter database rename file 'M:\ORADATA\YMS\REDO09B.LOG' to 'D:\app\Administrator\oradata\YMS\REDO09B.LOG';

alter database rename file 'M:\ORADATA\YMS\TEMP01.DBF' to 'D:\app\Administrator\oradata\YMS\TEMP01.DBF';

alter database rename file 'M:\ORADATA\YMS\TEMP02.DBF' to 'D:\app\Administrator\oradata\YMS\TEMP02.DBF';

alter database open resetlogs;

--1.更改用户名密码

update system.sys_user set userpassword='heavenben' where userid='admin';

--3.删除配置列表

delete from system.SYS_UPDATELIST t where Lower(filename)='smartyms.exe.config';

delete from system.SYS_UPDATELIST t where Lower(filename)='setup.ini';

--3.提交更改。

commit;

--4.创建数据库联接dblink

create database link yms16

connect to system identified by ymsoracle

using '(DESCRIPTION =

(ADDRESS_LIST =

(ADDRESS = (PROTOCOL = TCP)(HOST = 223.223.80.16)(PORT = 1521))

)

(CONNECT_DATA =

(SERVER = 223.223.80.16)

(SERVICE_NAME = YMS)

)

)';

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值