1.确认数据文件、控制文件、临时文件、日志文件 位置
/u4/oradata/mat
/u5/mat
2.oracle用户读写权限
# chown -R oracle:oinstall /u4
3.建立Oracle環境設置
$ mkdir -p /oracle/app/admin/mat/adump
$ mkdir -p /oracle/app/admin/mat/bdump
$ mkdir -p /oracle/app/admin/mat/cdump
$ mkdir -p /oracle/app/admin/mat/dpdump
$ mkdir -p /oracle/app/admin/mat/pfile
$ mkdir -p /oracle/app/admin/mat/udump
$ mkdir -p /oracle/app/flash_recovery_area
$ vi .bash_profile-mat
# Oracle ORACLE_BASE=/oracle/app ORACLE_HOME=$ORACLE_BASE/product/10.2.0 ORACLE_SID=mat TNS_ADMIN=$ORACLE_HOME/network/admin LD_LIBRARY_PATH=$ORACLE_HOME/lib NLS_LANG="AMERICAN_AMERICA.AL32UTF8" PATH=$PATH:$ORACLE_HOME/bin:$HOME/bin export ORACLE_BASE ORACLE_HOME ORACLE_SID LD_LIBRARY_PATH PATH
alias sqlplus='rlwrap sqlplus'
alias rman='rlwrap rman'
$ source .bash_profile-mat
4. 通过response文件运行NetCA
# su - oracle
$ cd /u4/response
$ $ORACLE_HOME/bin/netca /silent /responsefile /u4/response/netca.rsp
$ lsnrctl stop
5. 復制參數文件至 $ORACLE_HOME/dbs
hc_mat.dat initmat.ora orapwmat snapcf_mat.f spfilemat.ora
$ cd $ORACLE_HOME/dbs/
$ mv spfilemat.ora spfilemat.ora.old
$ cp initmat.ora initmat.ora.old
$ vi initmat.ora
$ sdiff -s initmat.ora initmat.ora.old
*.control_files='/u4/oradata/mat/control01.ctl','/u4/oradata/ | *.control_files='/data/oradata/mat/control01.ctl','/data/orad
*.log_archive_dest_1='LOCATION=/u5/mat' | *.log_archive_dest_1='LOCATION=/zserp01archive/mat'
6.1. 將資料庫開啟在moun
SQL> startup mount;
SQL> create spfile from pfile;
SQL> show parameter control_files;
更改数据文件、临时文件、日志文件位置
alter database rename file '/data/oradata/mat/redo01.log' to '/u4/oradata/mat/redo01.log' ; alter database rename file '/data/oradata/mat/redo02.log' to '/u4/oradata/mat/redo02.log' ; alter database rename file '/data/oradata/mat/redo03.log' to '/u4/oradata/mat/redo03.log' ; alter database rename file '/data/oradata/mat/sysaux01.dbf' to '/u4/oradata/mat/sysaux01.dbf' ; alter database rename file '/data/oradata/mat/system01.dbf' to '/u4/oradata/mat/system01.dbf' ; alter database rename file '/data/oradata/mat/temp01.dbf' to '/u4/oradata/mat/temp01.dbf' ; alter database rename file '/data/oradata/mat/undotbs01.dbf' to '/u4/oradata/mat/undotbs01.dbf' ; alter database rename file '/data/oradata/mat/users01.dbf' to '/u4/oradata/mat/users01.dbf' ;
6.2.停用JOB
SQL> alter system set job_queue_processes=0;
System altered.
6.3.執行recover 指令
SQL> recover database;
Media recovery complete.
SQL>
6.4.將資料庫開啟
SQL> alter database open;
Database altered.
参考: