{"id":192,"date":"2012-03-02T03:36:12","date_gmt":"2012-03-02T03:36:12","guid":{"rendered":"http:\/\/oranotes.tuktaroff.com\/?page_id=192"},"modified":"2012-03-02T03:38:41","modified_gmt":"2012-03-02T03:38:41","slug":"restore-from-backup","status":"publish","type":"page","link":"http:\/\/oranotes.tuktaroff.com\/?page_id=192","title":{"rendered":"Restore from backup"},"content":{"rendered":"<p><code><\/p>\n<pre class=\"qcode\">\r\nMake dirs:\r\n\/u0\/oradata\/<DBNAME>\r\n\/u0\/backup\/<DBNAME>\/(arch, rman)\r\n\/opt\/oracle\/admin\/<DBNAME>\/(pfile, adump, bdump, cdump, udump)\r\n\r\nCopy files:\r\nsourse:\/backup\/<DBNAME>\/rman\/* dest:\/backup\/<DBNAME>\/rman\/\r\n\r\n0. check OS variables (ORACLE_SID, etc).\r\n1. rman target \/\r\n2. set DBID <DBID> (DBID from ctl_spfile_<DBNAME>_%Y%M%D_<DBID>_NNN.rman)\r\n-- if spfile was used\r\n3. startup nomount;\r\n4. restore spfile from '\/backup\/MALINA\/rman\/ctl_spfile_MALINA_20070716_c-670772455-20070716-00.rman';\r\n-- or\r\nrestore spfile to '\/opt\/oracle\/product\/10.2\/dbs\/spfileMALINA.ora' from '\/backup\/MALINA\/rman\/ctl_spfile_MALINA_20070716_c-670772455-20070716-00.rman';\r\n5. startup force nomount; -- to read new settings from spfile\r\n-- if pfile was used\r\n4. copy pfile\r\n5. startup nomount;\r\n--\r\n6. restore controlfile from '\/backup\/MALINA\/rman\/ctl_spfile_MALINA_20070716_c-670772455-20070716-00.rman';\r\n7. shutdown immediate;\r\n7.1. os command: orapwd file=\/opt\/oracle\/product\/10.2\/dbs\/orapw<DBNAME> password=<sys_password>\r\n7.2 restart rman (rman target \/);\r\n8. startup mount;\r\n8.1 if need to change datafile location: (without temp tablespace)\r\nrun { set newname for datafile '\/u1\/<file1>' to '\/u0\/<file1>';\r\nset newname for datafile '\/u1\/<file2>' to '\/u0\/<file2>';\r\nrestore database;\r\nswitch datafile all;\r\n}\r\n(after restore datafile for all log files) sql \"alter database rename file <\/u1\/...> to <\/u0\/...>\"\r\n(after restore add tempfile) alter tablespace TEMP add tempfile '\/u0\/...' size XXM reuse;\r\n8.2 check\/change archivelog destination\r\nsql \"alter system set archive_log_dest_1='location=\/backup\/<DBNAME>\/arch';\"\r\n(alter system set log_archive_format='<CAP01>_%t_%s.arc')\r\n(alter system set log_archive_start=TRUE)\r\n9. restore database; -- if restoring from full backup\r\nor \r\n-- if restoring from incremental backup \r\nrestore database preview; \r\n-- and one of 2 variants:\r\n1) \r\nrestore database;\r\nrestore database from tag='BACKUP INC_1';\r\n2)\r\nrestore database from tag='BACKUP INC_0';\r\nrecover database;\r\n9.1 copy archlogs.\r\n10. sql \"recover database;\" or (recover database until cancel;) or (recover database using backup controlfile UNTIL TIME '2004-09-10:12:00:00';)\r\n10.1 -- if logfiles on another volume:\r\nsql \"alter database rename file <logfile1> to <logfile2>;\"\r\n11. sql \"alter database open resetlogs;\"\r\n11.1 --add tempfile (in 10g it does automatically)\r\nsql \"alter tablespace TEMP add tempfile '\/u0\/oradata\/<DBNAME>\/temp01.dbf' size 1000M autoextend on unlimited reuse;\"\r\n\r\n12.1 review tnsnames & listener config files.\r\n12.2 restart listener if needed.\r\n<\/pre>\n<p><\/code><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Make dirs: \/u0\/oradata\/ \/u0\/backup\/\/(arch, rman) \/opt\/oracle\/admin\/\/(pfile, adump, bdump, cdump, udump) Copy files: sourse:\/backup\/\/rman\/* dest:\/backup\/\/rman\/ 0. check OS variables (ORACLE_SID, etc). 1. rman target \/ 2. set DBID (DBID from ctl_spfile__%Y%M%D__NNN.rman) &#8212; if spfile was used 3. startup nomount; 4. restore spfile from &#8216;\/backup\/MALINA\/rman\/ctl_spfile_MALINA_20070716_c-670772455-20070716-00.rman&#8217;; &#8212; or restore spfile to &#8216;\/opt\/oracle\/product\/10.2\/dbs\/spfileMALINA.ora&#8217; from &#8216;\/backup\/MALINA\/rman\/ctl_spfile_MALINA_20070716_c-670772455-20070716-00.rman&#8217;; 5. startup force nomount; [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":190,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-192","page","type-page","status-publish","hentry"],"jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/P2NVny-36","_links":{"self":[{"href":"http:\/\/oranotes.tuktaroff.com\/index.php?rest_route=\/wp\/v2\/pages\/192","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/oranotes.tuktaroff.com\/index.php?rest_route=\/wp\/v2\/pages"}],"about":[{"href":"http:\/\/oranotes.tuktaroff.com\/index.php?rest_route=\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"http:\/\/oranotes.tuktaroff.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/oranotes.tuktaroff.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=192"}],"version-history":[{"count":3,"href":"http:\/\/oranotes.tuktaroff.com\/index.php?rest_route=\/wp\/v2\/pages\/192\/revisions"}],"predecessor-version":[{"id":197,"href":"http:\/\/oranotes.tuktaroff.com\/index.php?rest_route=\/wp\/v2\/pages\/192\/revisions\/197"}],"up":[{"embeddable":true,"href":"http:\/\/oranotes.tuktaroff.com\/index.php?rest_route=\/wp\/v2\/pages\/190"}],"wp:attachment":[{"href":"http:\/\/oranotes.tuktaroff.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=192"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}