關於我

我的相片
用心思考、保持熱情,把工作上的經驗作分享與紀錄。希望能夠跟大家一起不斷的成長~

oracle備份還原

《 備 份 》 <1>cmd視窗使用sysdba連上oracle C:\> sqlplus "sys/bankpro@oracle9i as sysdba" <2>將oracle資料庫關閉 SQL> shutdown normal; <3>將oracle資料庫資料複製一份 ( 預設於oradata內,如oracle9i資料夾 ) 《 還 原 》 <1>cmd視窗使用sysdba連上oracle C:\> sqlplus "sys/bankpro@oracle9i as sysdba" <2>將oracle資料庫關閉 SQL> shutdown normal; <3>複製備份檔案至oracle資料夾中 <4>開啟oracle資料庫至nomount模式 SQL> startup nomount; <5>提升資料庫至mount模式 SQL> alter database mount; <6>修改資料庫檔案掛載位置 SQL> alter database rename file 'E:\DANNYTEAM\DB\ORACLE\ORADATA\ORACLE9I\CWMLITE01.DBF' TO C:\ORACLE\ORADATA\ORACLE9I\CWMLITE01.DBF'; alter database rename file 'E:\DANNYTEAM\DB\ORACLE\ORADATA\ORACLE9I\DRSYS01.DBF' TO 'C:\ORACLE\ORADATA\ORACLE9I\DRSYS01.DBF'; alter database rename file 'E:\DANNYTEAM\DB\ORACLE\ORADATA\ORACLE9I\EXAMPLE01.DBF' TO 'C:\ORACLE\ORADATA\ORACLE9I\EXAMPLE01.DBF'; alter database rename file 'E:\DANNYTEAM\DB\ORACLE\ORADATA\ORACLE9I\EXCHANGE.ORA' TO 'C:\ORACLE\ORADATA\ORACLE9I\EXCHANGE.ORA'; alter database rename file 'E:\DANNYTEAM\DB\ORACLE\ORADATA\ORACLE9I\HIS.ORA' TO 'C:\ORACLE\ORADATA\ORACLE9I\HIS.ORA'; alter database rename file 'E:\DANNYTEAM\DB\ORACLE\ORADATA\ORACLE9I\INDX01.DBF' TO 'C:\ORACLE\ORADATA\ORACLE9I\INDX01.DBF'; alter database rename file 'E:\DANNYTEAM\DB\ORACLE\ORADATA\ORACLE9I\INVOICE.ORA' TO 'C:\ORACLE\ORADATA\ORACLE9I\INVOICE.ORA'; alter database rename file 'E:\DANNYTEAM\DB\ORACLE\ORADATA\ORACLE9I\ODM01.DBF' TO 'C:\ORACLE\ORADATA\ORACLE9I\ODM01.DBF'; alter database rename file 'E:\DANNYTEAM\DB\ORACLE\ORADATA\ORACLE9I\TOOLS01.DBF' TO C:\ORACLE\ORADATA\ORACLE9I\TOOLS01.DBF'; alter database rename file 'E:\DANNYTEAM\DB\ORACLE\ORADATA\ORACLE9I\UNDOTBS01.DBF' TO 'C:\ORACLE\ORADATA\ORACLE9I\UNDOTBS01.DBF'; alter database rename file 'E:\DANNYTEAM\DB\ORACLE\ORADATA\ORACLE9I\USERS01.DBF' TO 'C:\ORACLE\ORADATA\ORACLE9I\USERS01.DBF'; alter database rename file 'E:\DANNYTEAM\DB\ORACLE\ORADATA\ORACLE9I\XDB01.DBF' TO 'C:\ORACLE\ORADATA\ORACLE9I\XDB01.DBF'; alter database rename file 'E:\DANNYTEAM\DB\ORACLE\ORADATA\ORACLE9I\SYSTEM01.DBF' TO 'C:\ORACLE\ORADATA\ORACLE9I\SYSTEM01.DBF'; alter database rename file 'E:\DANNYTEAM\DB\ORACLE\ORADATA\ORACLE9I\REDO01.LOG' TO 'C:\ORACLE\ORADATA\ORACLE9I\REDO01.LOG'; alter database rename file 'E:\DANNYTEAM\DB\ORACLE\ORADATA\ORACLE9I\REDO02.LOG' TO 'C:\ORACLE\ORADATA\ORACLE9I\REDO02.LOG'; alter database rename file 'E:\DANNYTEAM\DB\ORACLE\ORADATA\ORACLE9I\REDO03.LOG' TO 'C:\ORACLE\ORADATA\ORACLE9I\REDO03.LOG'; 也可將上方Script製作成一個如Restore.txt的文字檔 再利用sqlplus執行: SQL> start c:\Restore.txt; 即可批次執行指令!! <7>提升資料庫至open模式 alter database open; <8>重新建立Temp檔 alter database tempfile 'E:\DANNYTEAM\DB\ORACLE\ORADATA\ORACLE9I\TEMP01.DBF' DROP; alter tablespace temp add tempfile 'C:\ORACLE\ORADATA\ORACLE9I\TEMP01.DBF' SIZE 40m reuse;

沒有留言:

張貼留言