{"id":2605,"date":"2019-03-12T12:48:14","date_gmt":"2019-03-12T09:48:14","guid":{"rendered":"https:\/\/sysdba.org\/?p=2605"},"modified":"2025-07-02T06:01:07","modified_gmt":"2025-07-02T06:01:07","slug":"managing-control-files","status":"publish","type":"post","link":"https:\/\/sysdba.org\/en\/managing-control-files\/","title":{"rendered":"Managing Control Files"},"content":{"rendered":"<p>The Control File can be considered to be the most important file in a database, it is the identity of the database.<\/p>\n<p>Every database instance has at least 1 control file, the recommended practice is to have at least 2 control files located on separate physical disks. 3 control files are created by default.<\/p>\n<p>The contents of a database&#8217;s Control File include:<\/p>\n<p>\u2022 The names and locations (paths) of Data Files<\/p>\n<p>\u2022 The names and locations of Redo Logs<\/p>\n<p>\u2022 Current Log sequence numbers<\/p>\n<p>\u2022 Backup Set information<\/p>\n<p>&amp; most importantly<\/p>\n<p>\u2022 System Change Number (SCN) information<\/p>\n<p>&nbsp;<\/p>\n<p>Users cannot view or alter a Control File as it is in binary format.<\/p>\n<p>&nbsp;<\/p>\n<h3><span style=\"text-decoration: underline;\"><span style=\"font-size: 0.9em; line-height: 1.3em;\">Making copies of Control Files<\/span><\/span><\/h3>\n<p>Control Files can be copied in two ways.<\/p>\n<p><strong>1. While the database is open<\/strong><\/p>\n<p>If a Control File&#8217;s location hasn&#8217;t been specified while creating the database, all 3 control files will be in the same path (<strong>\/u01\/app\/oracle\/oradata\/SID_NAME\/<\/strong>)<br \/>\n[crayon]<br \/>\nALTER SYSTEM SET control_files = &#8216;\/u01\/app\/oracle\/oradata\/smp\/control01.ctl&#8217;,<\/p>\n<p>&#8216;\/u01\/app\/oracle\/oradata\/smp\/control02.ctl&#8217;,<\/p>\n<p>&#8216;\/u01\/app\/oracle\/oradata\/smp\/control03.ctl&#8217;,<\/p>\n<p>&#8216;\/u02\/IndexData\/smp\/control04.ctl&#8217; scope=spfile;<br \/>\n[\/crayon]<\/p>\n<p>[crayon]<br \/>\nshutdown immediate<br \/>\n[\/crayon]<\/p>\n<p>[crayon]<br \/>\n[oracle@rhel ~]$ cp \/u01\/app\/oracle\/oradata\/smp\/control01.ctl \/u02\/IndexData\/smp\/control04.ct<br \/>\n[\/crayon]<\/p>\n<p>[crayon]<br \/>\nstartup<br \/>\n[\/crayon]<\/p>\n<p>Checking the validity of the changes that have been made:<\/p>\n<p>[crayon]<br \/>\nselect name from v$controlfile;<\/p>\n<p>NAME<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#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>\/u01\/app\/oracle\/oradata\/smp\/control01.ctl<\/p>\n<p>\/u01\/app\/oracle\/oradata\/smp\/control02.ctl<\/p>\n<p>\/u01\/app\/oracle\/oradata\/smp\/control03.ctl<\/p>\n<p>\/u02\/IndexData\/smp\/control04.ctl<br \/>\n[\/crayon]<\/p>\n<p>Changes can also be checked with:<\/p>\n<p>[crayon]<br \/>\nSQL&gt; show parameter control_files ;<br \/>\n[\/crayon]<\/p>\n<p><strong>2. Using the Pfile (Parameter file) to make copies<\/strong><br \/>\n[crayon]<br \/>\nshutdown immediate<br \/>\n[\/crayon]<\/p>\n<p><span style=\"font-size: 14.3999996185303px; line-height: 18.7199993133545px;\">The following code creates a pfile.<\/span><br \/>\n[crayon]<br \/>\ncreate pfile from spfile;<br \/>\n[\/crayon]<\/p>\n<p>&#8220;initSID_NAME.ora&#8221; in &#8220;\/u01\/app\/oracle\/product\/10.2.0\/db_1\/dbs\/&#8221;. In this example we have named the pfile initSMP.ora.<br \/>\n[crayon]<br \/>\n[oracle@rhel ~]$ cp \/u01\/app\/oracle\/oradata\/smp\/control01.ctl \/u03\/smp\/control05.ctl<br \/>\n[\/crayon]<\/p>\n<p>Using Vi or WinSCP&#8217;s text editor we can create the following configuration according our requirements:<br \/>\n[crayon]<br \/>\n*.control_files=&#8217;\/u01\/app\/oracle\/oradata\/smp\/control01.ctl&#8217;,&#8217;\/u01\/app\/oracle\/oradata\/smp\/control02.ctl&#8217;,&#8217;\/u01\/app\/oracle\/oradata\/smp\/control03.ctl&#8217;,&#8217;\/u02\/IndexData\/smp\/control04.ctl&#8217;,&#8217;\/u03\/smp\/control05.ctl&#8217;<br \/>\n[\/crayon]<\/p>\n<p>Create an spfile from the pfile after finishing working on the pfile.<br \/>\n[crayon]<br \/>\ncreate spfile from pfile;<\/p>\n<p>startup<br \/>\n[\/crayon]<\/p>\n<p>The database can be opened and checked using the following syntax.<br \/>\n[crayon]<br \/>\nselect name from v$controlfile;<\/p>\n<p>NAME<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#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>\/u01\/app\/oracle\/oradata\/smp\/control01.ctl<\/p>\n<p>\/u01\/app\/oracle\/oradata\/smp\/control02.ctl<\/p>\n<p>\/u01\/app\/oracle\/oradata\/smp\/control03.ctl<\/p>\n<p>\/u02\/IndexData\/smp\/control04.ctl<\/p>\n<p>\/u03\/smp\/control05.ctl<br \/>\n[\/crayon]<\/p>\n<p>If the dbms is unable to open a control file then it cannot open the database. Suggested solutions to this type of issue:<\/p>\n<p>\u2022 Delete the problematic control file, replace it with another functioning one and rename it.<\/p>\n<p>\u2022 If the other control files are in working order, delete the control file from the spfile (by using the same method as creating a pfile).<\/p>\n<p>&nbsp;<\/p>\n<p>Accessing Controlfile information<\/p>\n<p>V$CONTROLFILE : Contains the names and statuses of controlfiles.<\/p>\n<p>V$PARAMETER : Statuses and locations\/paths.<\/p>\n<p>V$CONTROLFILE_RECORD_SECTION : Datafiles and the objects that they contain (such as record_size, records_total)<\/p>\n<p>&nbsp;<\/p>\n<p>The performance view information listed below can be accessed through a control file:<\/p>\n<p>\u2022 V$BACKUP<\/p>\n<p>\u2022 V$DATAFILE<\/p>\n<p>\u2022 V$TEMPFILE<\/p>\n<p>\u2022 V$TABLESPACE<\/p>\n<p>\u2022 V$ARCHIVE<\/p>\n<p>\u2022 V$LOG<\/p>\n<p>\u2022 V$LOGFILE<\/p>\n<p>\u2022 V$LOGHIST<\/p>\n<p>\u2022 V$ARCHIVED_LOG<\/p>\n<p>\u2022 V$DATABASE<\/p>\n","protected":false},"excerpt":{"rendered":"<p>The Control File can be considered to be the most important file in a database, it is the identity of the database.<\/p>\n","protected":false},"author":1,"featured_media":3420,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[383,338],"tags":[345],"class_list":["post-2605","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-dba_i","category-oracle-tr","tag-oracle"],"_links":{"self":[{"href":"https:\/\/sysdba.org\/en\/wp-json\/wp\/v2\/posts\/2605","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/sysdba.org\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/sysdba.org\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/sysdba.org\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/sysdba.org\/en\/wp-json\/wp\/v2\/comments?post=2605"}],"version-history":[{"count":1,"href":"https:\/\/sysdba.org\/en\/wp-json\/wp\/v2\/posts\/2605\/revisions"}],"predecessor-version":[{"id":4823,"href":"https:\/\/sysdba.org\/en\/wp-json\/wp\/v2\/posts\/2605\/revisions\/4823"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/sysdba.org\/en\/wp-json\/"}],"wp:attachment":[{"href":"https:\/\/sysdba.org\/en\/wp-json\/wp\/v2\/media?parent=2605"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/sysdba.org\/en\/wp-json\/wp\/v2\/categories?post=2605"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/sysdba.org\/en\/wp-json\/wp\/v2\/tags?post=2605"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}