{"id":2677,"date":"2018-02-02T21:36:32","date_gmt":"2018-02-02T12:36:32","guid":{"rendered":"http:\/\/haisins.epac.to\/wordpress\/?p=2677"},"modified":"2018-02-02T21:36:52","modified_gmt":"2018-02-02T12:36:52","slug":"db_name%ea%b3%bc-sid-%eb%b3%80%ea%b2%bd%ed%95%98%eb%8a%94-%eb%b0%a9%eb%b2%95","status":"publish","type":"post","link":"http:\/\/haisins.synology.me\/wordpress\/?p=2677","title":{"rendered":"DB_NAME \uacfc SID \ubcc0\uacbd\ud558\ub294 \ubc29\ubc95"},"content":{"rendered":"<div id=\"page\" class=\"hfeed site\">\n<div id=\"main\" class=\"clearfix\">\n<div class=\"inner-wrap clearfix\">\n<div class=\"main-content-section clearfix\">\n<div id=\"primary\">\n<div id=\"content\" class=\"clearfix\">\n<div class=\"article-container\">\n<div class=\"article-content clearfix\">\n<div class=\"entry-content clearfix\">\n<div>\n<div id=\"002cc41c-1d37-4115-8122-0d3f842a9dd3\" class=\"postBody\" contenteditable=\"true\">\n<p><strong>Modifying a database to run under a new ORACLE_SID<\/strong><\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<\/p>\n<p>1. Shutdown instance<\/p>\n<p>&nbsp;<\/p>\n<p>2. Backup all control, redo and data files.<\/p>\n<p>&nbsp;<\/p>\n<p>3. Go thru the .profile, .cshrc, .login, oratab, tnsnames.ora(for net v2) , and redefine the environment variable ORACLE_SID to a new value. ie search thru disks and do a grep ORACLE_SID *<\/p>\n<p>&nbsp;<\/p>\n<p>4. cd $ORACLE_HOME\/dbs and rename the following files:<\/p>\n<p>o init.ora (or use pfile to point to the init file.)<\/p>\n<p>o control file(s) This is optional if you don&#8217;t rename any of the controlfiles, and the control_files parameter is used. control_files would be set in the initSID.ora file or in a file it references with the ifile parameter. Make sure control_files doesn&#8217;t point to any old file names, if you renamed them.<\/p>\n<p>o crdb.sql &amp; crdb2.sql This is optional. These are only used at database creation.<\/p>\n<p>&nbsp;<\/p>\n<p>5. cd $ORACLE_HOME\/rdbms\/admin and rename the file:<\/p>\n<p>o startup.sql This is optional. (On some platforms, this file may be in $ORACLE_HOME\/rdbms\/install.)<\/p>\n<p>Make sure the contents of this file do not reference old initSID.ora files that have been renamed. This file simplifies the process to &#8220;startup exclusive&#8221; your database.<\/p>\n<p>&nbsp;<\/p>\n<p>6. To rename the database files and redo log files, you would follow the instructions in the bulletin: 98863.723.<\/p>\n<p>&nbsp;<\/p>\n<p>7. Change the ORACLE_SID environment variable to the new value.<\/p>\n<p>&nbsp;<\/p>\n<p>8. start up database and verify it works. Once you have done this, shutdown the database and take a final backup of all control, redo and data files.<\/p>\n<p>&nbsp;<\/p>\n<p>9. When the instance is started, the control file gets updated with the current ORACLE_SID.<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p><strong>Changing the dbname for a database<\/strong><\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<\/p>\n<p>1. sqldba<\/p>\n<p>&nbsp;<\/p>\n<p>2. connect internal<\/p>\n<p>&nbsp;<\/p>\n<p>3. alter database backup controlfile to trace;<\/p>\n<p>This will write in a trace file, the CREATE CONTROLFILE command that would recreate the controlfile as it currently exists.<\/p>\n<p>&nbsp;<\/p>\n<p>4. Exit and go to the directory where your trace files are located.<\/p>\n<p>They are usually in the $ORACLE_HOME\/rdbms\/log directory.<\/p>\n<p>If user_dump_dest is set in the initSID.ora, then go to the directorylisted in the user_dump_dest variable.<\/p>\n<p>The trace file will have the form &#8220;ora_NNNN.trc with NNNN being a number.<\/p>\n<p>&nbsp;<\/p>\n<p>5. Get the CREATE CONTROLFILE command from the trace file and put it in a new file called something like ccf.sql.<\/p>\n<p>&nbsp;<\/p>\n<p>6. Edit the ccf.sql file and modify the CREATE CONTROLFILE command. Just change the word &#8220;REUSE&#8221; to &#8220;SET&#8221;,and &#8220;NORESETLOGS&#8221; to &#8220;RESETLOGS&#8221;, and modify the dbname.<\/p>\n<p><strong>Old line:<\/strong><\/p>\n<p><strong>CREATE CONTROLFILE REUSE DATABASE &#8220;olddbname&#8221; NORESETLOGS &#8230;<\/strong><\/p>\n<p><strong>New line:<\/strong><\/p>\n<p><strong>CREATE CONTROLFILE set DATABASE &#8220;newdbname&#8221; RESETLOGS &#8230;<\/strong><\/p>\n<p><strong>Then save the ccf.sql file.<\/strong><\/p>\n<p>&nbsp;<\/p>\n<p>7. Rename the old control files for backup purposes and so they are not in the way of creating the new ones.<\/p>\n<p>&nbsp;<\/p>\n<p>8. Edit initSID.ora so that db_name=&#8221;newdbname&#8221;.<\/p>\n<p>&nbsp;<\/p>\n<p>9. sqldba<\/p>\n<p>&nbsp;<\/p>\n<p>10. connect internal<\/p>\n<p>&nbsp;<\/p>\n<p>11. startup nomount<\/p>\n<p>&nbsp;<\/p>\n<p>12. @ccf<\/p>\n<p>&nbsp;<\/p>\n<p>13. alter database open;<\/p>\n<p>&nbsp;<\/p>\n<p>14. Make sure the database is working. Shutdown and backup the database.<\/p>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>Modifying a database to run under a new ORACLE_SID &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211; 1. Shutdown instance &nbsp; 2. Backup all control, redo and data files. &nbsp; 3. Go thru the .profile, .cshrc, .login, oratab, tnsnames.ora(for net v2) , and redefine the environment variable ORACLE_SID to a new value. ie search thru disks and do a grep ORACLE_SID * [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_bbp_topic_count":0,"_bbp_reply_count":0,"_bbp_total_topic_count":0,"_bbp_total_reply_count":0,"_bbp_voice_count":0,"_bbp_anonymous_reply_count":0,"_bbp_topic_count_hidden":0,"_bbp_reply_count_hidden":0,"_bbp_forum_subforum_count":0,"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"spay_email":""},"categories":[3],"tags":[879,877,533,878],"jetpack_featured_media_url":"","amp_enabled":true,"_links":{"self":[{"href":"http:\/\/haisins.synology.me\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/2677"}],"collection":[{"href":"http:\/\/haisins.synology.me\/wordpress\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/haisins.synology.me\/wordpress\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/haisins.synology.me\/wordpress\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/haisins.synology.me\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2677"}],"version-history":[{"count":2,"href":"http:\/\/haisins.synology.me\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/2677\/revisions"}],"predecessor-version":[{"id":2679,"href":"http:\/\/haisins.synology.me\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/2677\/revisions\/2679"}],"wp:attachment":[{"href":"http:\/\/haisins.synology.me\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2677"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/haisins.synology.me\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2677"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/haisins.synology.me\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2677"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}