{"id":3122,"date":"2019-04-27T18:45:22","date_gmt":"2019-04-27T16:45:22","guid":{"rendered":"http:\/\/van-maanen.com\/?p=3122"},"modified":"2019-04-27T18:45:22","modified_gmt":"2019-04-27T16:45:22","slug":"hot-backup-in-oracle","status":"publish","type":"post","link":"http:\/\/archief.van-maanen.com\/?p=3122","title":{"rendered":"Hot backup in Oracle"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">It is possible to make a hot backup in Oracle. This implies that we do not have to shutdown the database before creating a backup.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The steps are as follows:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">First, we check if the system is in an archive mode:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">archive log list<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">This command is given in sqlplus when logged in as sysdba. The answer from the system should be something like &#8220;Database log mode Archive Mode&#8221;. This indicates that archive files are created. The files look like &#8220;ARC0000000197_0999381692.0001&#8221; in a directory. In my case the directory is &#8220;C:\\app\\tmaanen\\product\\12.1.0\\dbhome_1\\RDBMS&#8221;.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">We also must verify where the datafiles are stored. This can be checked with:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">select file_id, file_name from dba_data_files;<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">We can then check which archive log is relevant:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">select group#, sequence#, status from v$log;<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Now, we can start the backup:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">alter database begin backup;<br>alter system switch logfile;<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Now copy all datafiles (*.dbf) , all archive files (ARC*.*) and the controlfiles.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Then continue the system:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">alter database end backup;<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">To restore the database, we must take several steps:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">First, shutdown the instance:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">shutdown immediate<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Copy the *.dbf files to the datafile locatipon. Copy the controlfiles to controlfile location. Copy the archive files to the archive location.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Then start Oracle in the mount status:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">startup mount;<br>recover database until cancel using backup controlfile;<br><br><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">With the latter command, we must indicate &#8220;AUTO&#8221;.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">We start the database with <\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">alter database open resetlogs;<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">This should provide the consistent database on the moment when database was backed up.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>It is possible to make a hot backup in Oracle. This implies that we do not have to shutdown the database before creating a backup. The steps are as follows: First, we check if the system is in an archive mode: archive log list This command is given in sqlplus when logged in as sysdba. [&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-3122","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\/3122","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=3122"}],"version-history":[{"count":0,"href":"http:\/\/archief.van-maanen.com\/index.php?rest_route=\/wp\/v2\/posts\/3122\/revisions"}],"wp:attachment":[{"href":"http:\/\/archief.van-maanen.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=3122"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/archief.van-maanen.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=3122"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/archief.van-maanen.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=3122"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}