移动开发管理系统CQ后台数据库ORACLE数据到EXP300阵列步骤
1、目的:
Oracle程序在本地硬盘上(D盘),数据在EXP300磁盘阵列上(Y盘),要求通过手工的方式切换磁盘阵列的磁盘,在两台服务器上(10.25.4.162和10.25.4.163)能够分别运行同一ORACLE数据库。
数据库备份,通过exp导出的方式备份数据到本地硬盘。
2、操作步骤:
以下称10.25.4.162为A机,10.25.4.163为B机。A机上已经安装了ORACLE程序,安装位置在D:/oracle,数据位置在D:/oracle/oradata,Dump文件位于D:/oracle/admin下,SID为ORADEV。
2.1、在B机D盘上安装ORACLE程序,生成ORADEV数据库,停止Oracle相关服务,设置服务为手工启动,删除D:/oracle/admin和D:/oracle/oradata目录。
2.2、查询A机Oracle数据文件位置
SQL> conn / as sysdba;
Connected.
SQL> select file#,name from v$datafile;
FILE# NAME
---------- -----------------------------------------------------------------------------
1 D:/ORACLE/ORADATA/ORADEV/SYSTEM01.DBF
2 D:/ORACLE/ORADATA/ORADEV/UNDOTBS01.DBF
3 D:/ORACLE/ORADATA/ORADEV/CWMLITE01.DBF
4 D:/ORACLE/ORADATA/ORADEV/DRSYS01.DBF
5 D:/ORACLE/ORADATA/ORADEV/EXAMPLE01.DBF
6 D:/ORACLE/ORADATA/ORADEV/INDX01.DBF
7 D:/ORACLE/ORADATA/ORADEV/ODM01.DBF
8 D:/ORACLE/ORADATA/ORADEV/TOOLS01.DBF
9 D:/ORACLE/ORADATA/ORADEV/USERS01.DBF
10 D:/ORACLE/ORADATA/ORADEV/XDB01.DBF
10 rows selected.
SQL> select file#,name from v$tempfile;
FILE# NAME
---------- -----------------------------------------------------------------------------------------
1 D:/ORACLE/ORADATA/ORADEV/TEMP01.DBF
SQL>
SQL> select group#,member from v$logfile;
GROUP# MEMBER
---------- -----------------------------------------------------------------------------------------
3 D:/ORACLE/ORADATA/ORADEV/REDO03.LOG
2 D:/ORACLE/ORADATA/ORADEV/REDO02.LOG
1 D:/ORACLE/ORADATA/ORADEV/REDO01.LOG
2.3创建pfile,停掉数据库,修改相关dump和control file文件位置从D盘到Y盘
SQL> create pfile from spfile;
File created.
2.4在Y盘建立Y:/oracle目录,剪切D:/oracle/admin和D:/oracle/oradata到Y:/oracle下。修改相关Oracle设置。
SQL> conn / as sysdba;
Connected to an idle instance.
SQL> startup mount pfile=D:/oracle/ora92/database/INIToradev.ORA
ORACLE instance started.
Total System Global Area126950220 bytes
Fixed Size 453452 bytes
Variable Size 109051904 bytes
Database Buffers 16777216 bytes
Redo Buffers 667648 bytes
Database mounted.
SQL>
SQL> alter database rename file 'D:/ORACLE/ORADATA/ORADEV/SYSTEM01.DBF' to 'Y:/ORACLE/ORADATA/ORADEV/SYSTEM01.DBF';
Database altered.
SQL> alter database rename file 'D:/ORACLE/ORADATA/ORADEV/UNDOTBS01.DBF' to 'Y:/ORACLE/ORADATA/ORADEV/UNDOTBS01.DBF';
Database altered.
SQL> alter database rename file 'D:/ORACLE/ORADATA/ORADEV/CWMLITE01.DBF' to 'Y:/ORACLE/ORADATA/ORADEV/CWMLITE01.DBF';
Database altered.
SQL> alter database rename file 'D:/ORACLE/ORADATA/ORADEV/DRSYS01.DBF' to 'Y:/ORACLE/ORADATA/ORADEV/DRSYS01.DBF';
Database altered.
SQL> alter database rename file 'D:/ORACLE/ORADATA/ORADEV/EXAMPLE01.DBF' to 'Y:/ORACLE/ORADATA/ORADEV/EXAMPLE01.DBF';
Database altered.
SQL> alter database rename file 'D:/ORACLE/ORADATA/ORADEV/INDX01.DBF' to 'Y:/ORACLE/ORADATA/ORADEV/INDX01.DBF';
Database altered.
SQL> alter database rename file 'D:/ORACLE/ORADATA/ORADEV/ODM01.DBF' to 'Y:/ORACLE/ORADATA/ORADEV/ODM01.DBF';
Database altered.
SQL> alter database rename file 'D:/ORACLE/ORADATA/ORADEV/TOOLS01.DBF' to 'Y:/ORACLE/ORADATA/ORADEV/TOOLS01.DBF';
Database altered.
SQL> alter database rename file 'D:/ORACLE/ORADATA/ORADEV/USERS01.DBF' to 'Y:/ORACLE/ORADATA/ORADEV/USERS01.DBF';
Database altered.
SQL> alter database rename file 'D:/ORACLE/ORADATA/ORADEV/XDB01.DBF' to 'Y:/ORACLE/ORADATA/ORADEV/XDB01.DBF';
Database altered.
SQL> alter database rename file 'D:/ORACLE/ORADATA/ORADEV/REDO01.LOG' to 'Y:/ORACLE/ORADATA/ORADEV/REDO01.LOG';
Database altered.
SQL> alter database rename file 'D:/ORACLE/ORADATA/ORADEV/REDO02.LOG' to 'Y:/ORACLE/ORADATA/ORADEV/REDO02.LOG';
Database altered.
SQL> alter database rename file 'D:/ORACLE/ORADATA/ORADEV/REDO03.LOG' to 'Y:/ORACLE/ORADATA/ORADEV/REDO03.LOG';
Database altered.
SQL> alter database open;
Database altered.
SQL> alter tablespace temp add tempfile 'Y:/ORACLE/ORADATA/ORADEV/TEMP01.DBF';
Tablespace altered.
SQL> startup pfile=D:/oracle/ora92/database/INIToradev.ORA
ORACLE instance started.
Total System Global Area126950220 bytes
Fixed Size 453452 bytes
Variable Size 109051904 bytes
Database Buffers 16777216 bytes
Redo Buffers 667648 bytes
Database mounted.
Database opened.
SQL> create spfile from pfile;
File created.
SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup;
ORACLE instance started.
Total System Global Area126950220 bytes
Fixed Size 453452 bytes
Variable Size 109051904 bytes
Database Buffers 16777216 bytes
Redo Buffers 667648 bytes
Database mounted.
Database opened.
2.5、验证数据库文件路径。
SQL> select file#,name from v$datafile;
FILE# NAME
---------- -----------------------------------------------------------------------------------------
1 Y:/ORACLE/ORADATA/ORADEV/SYSTEM01.DBF
2 Y:/ORACLE/ORADATA/ORADEV/UNDOTBS01.DBF
3 Y:/ORACLE/ORADATA/ORADEV/CWMLITE01.DBF
4 Y:/ORACLE/ORADATA/ORADEV/DRSYS01.DBF
5 Y:/ORACLE/ORADATA/ORADEV/EXAMPLE01.DBF
6 Y:/ORACLE/ORADATA/ORADEV/INDX01.DBF
7 Y:/ORACLE/ORADATA/ORADEV/ODM01.DBF
8 Y:/ORACLE/ORADATA/ORADEV/TOOLS01.DBF
9 Y:/ORACLE/ORADATA/ORADEV/USERS01.DBF
10 Y:/ORACLE/ORADATA/ORADEV/XDB01.DBF
10 rows selected.
SQL> select group#,member from v$logfile;
GROUP# MEMBER
---------- -----------------------------------------------------------------------------------------
3 Y:/ORACLE/ORADATA/ORADEV/REDO03.LOG
2 Y:/ORACLE/ORADATA/ORADEV/REDO02.LOG
1 Y:/ORACLE/ORADATA/ORADEV/REDO01.LOG
SQL> select file#,name from v$tempfile;
FILE# NAME
---------- -----------------------------------------------------------------------------------------
1 Y:/ORACLE/ORADATA/ORADEV/TEMP01.DBF
SQL>
2.6、拷贝A机文件D:/oracle/ora92/database/spfileoradev.ORA和PWDORADEV.ORA文件到B机相同的位置覆盖同名文件。
2.7、手工切换磁盘和起停Oracle服务,经验证Oracle能够在两台服务器上正常运行。
2.8、在A机D盘建立backup目录,在根目录下建立文件orabackup.cmd
exp system/password@oradev full=y file=d:/backup/oradata_%date:~0,4%%date:~5,2%%date:~8,2%.dmp log=d:/backup/oradata_%date:~0,4%%date:~5,2%%date:~8,2%.log
2.9、在系统计划任务里制定运行计划备份数据库。