{"id":3046,"date":"2019-04-12T22:02:47","date_gmt":"2019-04-12T20:02:47","guid":{"rendered":"http:\/\/van-maanen.com\/?p=3046"},"modified":"2019-04-12T22:02:47","modified_gmt":"2019-04-12T20:02:47","slug":"cold-backup-in-oracle","status":"publish","type":"post","link":"http:\/\/archief.van-maanen.com\/?p=3046","title":{"rendered":"Cold backup in Oracle"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">Actually, taking a cold backup in Oracle is quite simple. If you choose to undertake a cold backup by copying tables, it consists of 5 steps.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Step 1 is identifying the location of the data files. We have 3 commands for that:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">select name from v$datafile;<br>select member from v$logfile;<br>select name from v$controlfile;<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">We must remember these files for later copying actions.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Step 2 is making a copy of the spfile by:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">create pfile from spfile;<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">This will create a PFILE named initSID.ora in your $ORACLE_HOME\/database (Windows) or $ORACLE_HOME\/dbs (Linux\/Unix) directory.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Step 3 is forcing Oracle to create a checkpoint:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">alter system switch logfile;<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Step 4 is to stop the Oracle instance:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">shutdown immediate<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Step 5 is copying all files as identified in step 1 and the pfile from step 2 into a safe place.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">This leads to a situation where we have a bunch of files that we can use to restore the database. Another possibility is to clone the database in another instance. I tried this by installing an Oracle instance elsewhere and copy the files to its appropiate location. However, I noticed that I had to use the exact same version of Oracle, the same folder structure and the same platform. <\/p>\n\n\n\n<p class=\"wp-block-paragraph\">So I used Oracle 12 release 1 on Windows 10 with an identical folder structure as the original Oracle 12 release 1. I then copied the files from above to the new instance and voila: it worked. Two times the same Oracle instance and database.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">This copying action was undertaken with both instances being shutdown. So it was a cold backup from instance 1 that was restored in instance 2. <\/p>\n","protected":false},"excerpt":{"rendered":"<p>Actually, taking a cold backup in Oracle is quite simple. If you choose to undertake a cold backup by copying tables, it consists of 5 steps. Step 1 is identifying the location of the data files. We have 3 commands for that: select name from v$datafile;select member from v$logfile;select name from v$controlfile; We must remember [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[],"class_list":["post-3046","post","type-post","status-publish","format-standard","hentry","category-allgemein"],"_links":{"self":[{"href":"http:\/\/archief.van-maanen.com\/index.php?rest_route=\/wp\/v2\/posts\/3046","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/archief.van-maanen.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/archief.van-maanen.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/archief.van-maanen.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/archief.van-maanen.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=3046"}],"version-history":[{"count":0,"href":"http:\/\/archief.van-maanen.com\/index.php?rest_route=\/wp\/v2\/posts\/3046\/revisions"}],"wp:attachment":[{"href":"http:\/\/archief.van-maanen.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=3046"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/archief.van-maanen.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=3046"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/archief.van-maanen.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=3046"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}