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)
)
)';