<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>d-h-n.de</title>
	<atom:link href="http://d-h-n.de/blog/feed" rel="self" type="application/rss+xml" />
	<link>http://d-h-n.de/blog</link>
	<description>Blog about Oracle, Linux..</description>
	<lastBuildDate>Thu, 16 Aug 2012 06:57:44 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Create Oracle user using OS Authentication</title>
		<link>http://d-h-n.de/blog/create-oracle-user-using-os-authentication</link>
		<comments>http://d-h-n.de/blog/create-oracle-user-using-os-authentication#comments</comments>
		<pubDate>Thu, 16 Aug 2012 06:57:44 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Oracle]]></category>

		<guid isPermaLink="false">http://localhost/blog/?p=1649</guid>
		<description><![CDATA[as root create a new OS user: # useradd -g dba -G oinstall tim &#160; Add a database user: [oracle@ol62 ~]$ sqlplus / as sysdba First see parameter os_authent_prefix, remote_os_authent: SYS@orcl> show parameter os_authent NAME TYPE VALUE ------------------------------------ ----------- ------------------------------ os_authent_prefix string ops$ remote_os_authent boolean FALSE remote_os_authent default is FALSE &#160; &#160; Create user tim [...]]]></description>
			<content:encoded><![CDATA[<p>as root create a new OS user:</p>
<pre>
# useradd -g dba -G oinstall tim
</pre>
<p>&nbsp;<br />
Add a database user:</p>
<pre>
[oracle@ol62 ~]$ sqlplus / as sysdba
</pre>
<p>First see parameter os_authent_prefix, remote_os_authent:</p>
<pre>
SYS@orcl> show parameter os_authent

NAME				     TYPE	 VALUE
------------------------------------ ----------- ------------------------------
os_authent_prefix		     string	 ops$
remote_os_authent		     boolean	 FALSE
</pre>
<p>remote_os_authent default is FALSE<br />
&nbsp;<br />
&nbsp;<br />
Create user tim using OS Authentication:</p>
<pre>
SQL> alter system set <span class="bgy">remote_os_authent=true</span> scope=spfile;
SQL> create user <span class="bgy">ops$</span>tim identified <span class="bgy">externally;</span>
SQL> grant dba to ops$tim;
</pre>
<p>&nbsp;<br />
&nbsp;<br />
Login tim as OS user:</p>
<pre>
[root@ol62 ~]# cp /home/oracle/.bash_profile /home/tim/.bash_profile
cp: overwrite `/home/tim/.bash_profile'? y
[root@ol62 ~]# su - tim
</pre>
<p>Connect DB local:</p>
<pre>
[tim@ol62 ~]$ sqlplus /
...
SQL> show user
USER is "OPS$TIM"
</pre>
<p>&nbsp;<br />
Restart DB:</p>
<pre>
SYS@orcl> shutdown immediate
SYS@orcl> startup
ORA-32004: obsolete or deprecated parameter(s) specified for RDBMS instance
ORACLE instance started.
..
</pre>
<p>The REMOTE_OS_AUTHENT initialization parameter is deprecated in 11g<br />
&nbsp;<br />
&nbsp;<br />
Connect DB remote:</p>
<pre>
[tim@ol62 ~]$ sqlplus /@orcl
</pre>
<p>or</p>
<pre>
[tim@ol62 ~]$ sqlplus /@ol62/orcl.mydom.com
</pre>
<p>orcl is net_service_name (in tnsnames.ora)<br />
ol62 is hostname<br />
orcl.mydom.com is service_name</p>
]]></content:encoded>
			<wfw:commentRss>http://d-h-n.de/blog/create-oracle-user-using-os-authentication/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Duplicate database to a remote server from active database</title>
		<link>http://d-h-n.de/blog/duplicate-database-to-a-remote-server-from-active-database</link>
		<comments>http://d-h-n.de/blog/duplicate-database-to-a-remote-server-from-active-database#comments</comments>
		<pubDate>Wed, 08 Aug 2012 20:53:55 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Oracle]]></category>

		<guid isPermaLink="false">http://localhost/blog/?p=1617</guid>
		<description><![CDATA[Duplicate a datbase orcl to orcl2 on a remote server Prepare on source server listener.ora SID_LIST_LISTENER = (SID_LIST = (SID_DESC = (GLOBAL_DBNAME = orcl.mydom.com) (ORACLE_HOME = /u01/app/oracle/product/11.2.0/dbhome_1) (SID_NAME = orcl) ) ) LISTENER = (DESCRIPTION_LIST = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = ol62.mydom.com)(PORT = 1521)) (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521)) ) [...]]]></description>
			<content:encoded><![CDATA[<p>Duplicate a datbase orcl to orcl2 on a remote server</p>
<h3>Prepare on source server </h3>
<p>listener.ora</p>
<pre>
SID_LIST_LISTENER =
  (SID_LIST =
    (SID_DESC =
      (GLOBAL_DBNAME = orcl.mydom.com)
      (ORACLE_HOME = /u01/app/oracle/product/11.2.0/dbhome_1)
      (SID_NAME = orcl)
    )
  )

LISTENER =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = TCP)(HOST = ol62.mydom.com)(PORT = 1521))
      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
    )
  )

ADR_BASE_LISTENER = /u01/app/oracle
</pre>
<p>tnsnames.ora</p>
<pre>
ORCL =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = ol62)(PORT = 1521))
    )
    (CONNECT_DATA =
      (SERVICE_NAME = orcl.mydom.com)
    )
  )

ORCL2 =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.80.20)(PORT = 1521))
    )
    (CONNECT_DATA =
      (SERVICE_NAME = orcl2.mydom.com)
    )
  )
</pre>
<p>&nbsp;<br />
&nbsp;</p>
<h3>Prepare on destination server</h3>
<p>listener.ora</p>
<pre>
SID_LIST_LISTENER =
  (SID_LIST =
    (SID_DESC =
      (GLOBAL_DBNAME = orcl2.mydom.com)
      (ORACLE_HOME = /u01/app/oracle/product/11.2.0/dbhome_1)
      (SID_NAME = orcl2)
    )
  )

LISTENER =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = TCP)(HOST = pctest.mydom.com)(PORT = 1521))
      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
    )
  )

ADR_BASE_LISTENER = /u01/app/oracle
</pre>
<p>&nbsp;<br />
tnsnames.ora</p>
<pre>
ORCL2 =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = pctest)(PORT = 1521))
    )
    (CONNECT_DATA =
      (SERVICE_NAME = orcl2.mydom.com)
    )
  )
</pre>
<p>&nbsp;<br />
on destination server create new pfile initorcl2.ora (in $ORACLE_HOME/dbs)</p>
<pre>
db_name="orcl2"
</pre>
<p>&nbsp;<br />
on destination server create password file:</p>
<pre>
$ orapwd file=orapworcl2 password=foo entries=20 ignorecase=n
</pre>
<p>&nbsp;<br />
on destination server make directories: </p>
<pre>
mkdir -p /u01/app/oracle/oradata/orcl2
mkdir -p /u01/app/oracle/fast_recovery_area/orcl2
mkdir -p /u01/app/oracle/admin/orcl2/adump
mkdir -p /u01/app/oracle/diag/rdbms/orcl2/orcl2/trace
mkdir -p /u01/app/oracle/diag/rdbms/orcl2/orcl2/cdump
mkdir -p /u01/app/oracle/diag/rdbms/orcl2/orcl2/trace
</pre>
<p>&nbsp;</p>
<h3>Start DBs and run duplicate</h3>
<p>from source server startup DBs:<br />
start target db:</p>
<pre>
$ rlwrap sqlplus sys/foo@<span class="bgy">orcl</span> as sysdba
SYS@orcl> startup
SYS@orcl> exit
</pre>
<p>start auxiliary db:</p>
<pre>
$ rlwrap sqlplus sys/foo@<span class="bgy">orcl2</span> as sysdba
SYS@orcl2> startup <span class="bgy">nomount</span>
SYS@orcl2> exit
</pre>
<p>&nbsp;<br />
from source server start rman and connect DBs:</p>
<pre>
[oracle@ol62 ~]$ rlwrap rman target sys/foo@orcl auxiliary sys/foo@orcl2

connected to <span class="bgy">target</span> database: ORCL (DBID=1317794828)
connected to <span class="bgy">auxiliary</span> database: ORCL2 (<span class="bgy">not mounted</span>)
</pre>
<p>&nbsp;<br />
Run duplicate command:</p>
<pre>
RMAN> duplicate target database to orcl2
<span class="bgy">from active database</span>
spfile
parameter_value_convert =
'/orcl/', '/orcl2/'
set log_file_name_convert =
'/u01/app/oracle/oradata/orcl/', '/u01/app/oracle/oradata/orcl2/'
db_file_name_convert =
'/u01/app/oracle/oradata/orcl/', '/u01/app/oracle/oradata/orcl2/';
</pre>
<p>File $ORACLE_HOME/dbs/spfileorcl2.ora is created after duplicate.<br />
Also remove pfile initorcl2.ora</p>
]]></content:encoded>
			<wfw:commentRss>http://d-h-n.de/blog/duplicate-database-to-a-remote-server-from-active-database/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Duplicate Oracle database on the same server</title>
		<link>http://d-h-n.de/blog/duplicate-oracle-database-on-the-same-server</link>
		<comments>http://d-h-n.de/blog/duplicate-oracle-database-on-the-same-server#comments</comments>
		<pubDate>Wed, 01 Aug 2012 21:01:56 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Oracle]]></category>

		<guid isPermaLink="false">http://localhost/blog/?p=1580</guid>
		<description><![CDATA[Duplicate database from backups TDO: on the same server duplicate a database named orcl to a new database name orcl2 from a full backup &#160; 1. Backup database [oracle@ol62 ~]$ rlwrap rman target / RMAN> backup database plus archivelog; &#160; 2. Setup static listener Edit file listener.ora SID_LIST_LISTENER = (SID_LIST = (SID_DESC = (GLOBAL_DBNAME = [...]]]></description>
			<content:encoded><![CDATA[<h2>Duplicate database from backups</h2>
<p>
TDO: on the same server duplicate a database named <em>orcl</em> to a new database name <em>orcl2</em> <strong>from a full backup</strong>
</p>
<p>&nbsp;</p>
<h4>1. Backup database</h4>
<pre>
[oracle@ol62 ~]$ rlwrap rman target /
RMAN> backup database plus archivelog;
</pre>
<p>&nbsp;</p>
<h4>2. Setup static listener</h4>
<p>Edit file listener.ora</p>
<pre>
<span class="bgy">SID_LIST_LISTENER =
  (SID_LIST =
    (SID_DESC =
      (GLOBAL_DBNAME = orcl2.mydom.com)
      (ORACLE_HOME = /u01/app/oracle/product/11.2.0/dbhome_1)
      (SID_NAME = orcl2)
    )
    (SID_DESC =
      (GLOBAL_DBNAME = orcl.mydom.com)
      (ORACLE_HOME = /u01/app/oracle/product/11.2.0/dbhome_1)
      (SID_NAME = orcl)
    )
  )</span>

LISTENER =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = TCP)(HOST = ol62.mydom.com)(PORT = 1521))
      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
    )
  )

ADR_BASE_LISTENER = /u01/app/oracle
</pre>
<p>&nbsp;<br />
start or reload listener</p>
<pre>
LSNRCTL> reload
LSNRCTL> stat
..Services Summary...
Service "orcl.mydom.com" has 2 instance(s).
  Instance "orcl", status UNKNOWN, has 1 handler(s) for this service...
  Instance "orcl", status READY, has 1 handler(s) for this service...
Service "orcl2.mydom.com" has 1 instance(s).
  Instance "orcl2", status UNKNOWN, has 1 handler(s) for this service...
Service "orclXDB.mydom.com" has 1 instance(s).
  Instance "orcl", status READY, has 1 handler(s) for this service...
The command completed successfully
</pre>
<p>&nbsp;</p>
<h4>3. Config tnsnames.ora</h4>
<pre>
ORCL =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = ol62)(PORT = 1521))
    )
    (CONNECT_DATA =
      (SERVICE_NAME = orcl.mydom.com)
    )
  )

ORCL2 =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = ol62)(PORT = 1521))
    )
    (CONNECT_DATA =
      (SERVICE_NAME = orcl2.mydom.com)
    )
  )
</pre>
<p>&nbsp;</p>
<h4>4. Create a new pfile initorcl2.ora (in $ORACLE_HOME/dbs/)</h4>
<pre>
<span class="bgy">db_name</span>='orcl2'
<span class="bgy">control_files</span>='/u01/app/oracle/oradata/orcl2/control01.ctl',
'/u01/app/oracle/fast_recovery_area/orcl2/control02.ctl'
<span class="bgy">db_file_name_convert</span>='/u01/app/oracle/oradata/orcl/','/u01/app/oracle/oradata/orcl2/'
<span class="bgy">log_file_name_convert</span>='/u01/app/oracle/oradata/orcl/','/u01/app/oracle/oradata/orcl2/'
</pre>
<p>&nbsp;</p>
<h4>5. Create new directories</h4>
<p>for: data files, control file, audit_file_dest, background_dump_dest, core_dump_dest, user_dump_dest	</p>
<pre>
mkdir -p /u01/app/oracle/oradata/orcl2
mkdir -p /u01/app/oracle/fast_recovery_area/orcl2
mkdir -p /u01/app/oracle/admin/orcl2/adump
mkdir -p /u01/app/oracle/diag/rdbms/orcl2/orcl2/trace
mkdir -p /u01/app/oracle/diag/rdbms/orcl2/orcl2/cdump
mkdir -p /u01/app/oracle/diag/rdbms/orcl2/orcl2/trace
</pre>
<p>&nbsp;</p>
<h4>6. Create password file for orcl2</h4>
<pre>
$ cd $ORACLE_HOME/dbs
$ orapwd file=orapworcl2 password=foo2 entries=20 ignorecase=n
</pre>
<p>-> Password file orapworcl2 created<br />
&nbsp;<br />
or just copy file orapworcl to orapworcl2 if using the same password</p>
<pre>
$ cp orapworcl orapworcl2
</pre>
<p>&nbsp;</p>
<h4>7. Starting DBs</h4>
<p>Start auxiliary (duplicate) DB orcl2</p>
<pre>
$ sqlplus sys/foo2@orcl2 as sysdba
SYS@orcl2> startup <span class="bgy">nomount</span>
</pre>
<p>Start target (source) DB orcl</p>
<pre>
$ sqlplus sys/foo@orcl as sysdba
SYS@orcl> startup open
</pre>
<p>&nbsp;</p>
<h4>8. Starting rman and run duplicate</h4>
<p>conect target (source) DB orcl and auxiliary (duplicate) DB orcl2</p>
<pre>
[oracle@ol62 ~]$ rlwrap rman <span class="bgy">target sys/foo@orcl</span> <span class="bgy">auxiliary sys/foo2@orcl2</span>
..
connected to <span class="bgy">target</span> database: ORCL (DBID=1317794828)
connected to <span class="bgy">auxiliary</span> database: ORCL2 (not mounted)
</pre>
<p>&nbsp;</p>
<pre>
RMAN> <span class="bgy">duplicate target database to orcl2;</span>
</pre>
<p>&nbsp;<br />
&nbsp;</p>
<h2>Duplicate database from active database</h2>
<p>&nbsp;</p>
<h4>1. Backup database</h4>
<p>no need a backup<br />
&nbsp;</p>
<h4>2. Setup static listener</h4>
<p>same as above<br />
&nbsp;</p>
<h4>3. Config tnsnames.ora</h4>
<p>same as above<br />
&nbsp;</p>
<h4>4. Create a new pfile initorcl2.ora (in $ORACLE_HOME/dbs/)</h4>
<p>with only this line:</p>
<pre>
db_name="orcl2"
</pre>
<p>&nbsp;</p>
<h4>5. Create new directories</h4>
<p>same as above<br />
&nbsp;</p>
<h4>6. Create password file for orcl2</h4>
<p>same as above<br />
&nbsp;</p>
<h4>7. Starting DBs</h4>
<p>same as above<br />
&nbsp;</p>
<h4>8. Starting rman and run duplicate</h4>
<pre>
[oracle@ol62 ~]$ rlwrap rman <span class="bgy">target sys/foo@orcl</span> <span class="bgy">auxiliary sys/foo2@orcl2</span>
</pre>
<p>..</p>
<pre>
RMAN> duplicate target database to orcl2
<span class="bgy">from active database</span>
spfile
<span class="bgy">parameter_value_convert =</span>
'/orcl/', '/orcl2/'
<span class="bgy">set log_file_name_convert =</span>
'/u01/app/oracle/oradata/orcl/', '/u01/app/oracle/oradata/orcl2/'
<span class="bgy">db_file_name_convert =</span>
'/u01/app/oracle/oradata/orcl/', '/u01/app/oracle/oradata/orcl2/';
</pre>
]]></content:encoded>
			<wfw:commentRss>http://d-h-n.de/blog/duplicate-oracle-database-on-the-same-server/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>RMAN &#8211; Multisection Backups</title>
		<link>http://d-h-n.de/blog/rman-multisection-backups</link>
		<comments>http://d-h-n.de/blog/rman-multisection-backups#comments</comments>
		<pubDate>Mon, 30 Jul 2012 21:45:35 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Oracle]]></category>

		<guid isPermaLink="false">http://localhost/blog/?p=1572</guid>
		<description><![CDATA[What is Multisection Backups? is a new feature in 11g enables to back up and restore large files in more sections section is a contiguous set of blocks in a file each backup piece in a backup set will contain a section &#160; Example RMAN> configure device type disk parallelism 2; RMAN> backup SECTION size [...]]]></description>
			<content:encoded><![CDATA[<p>What is Multisection Backups?</p>
<ul>
<li>is a new feature in 11g</li>
<li>enables to back up and restore large files in more sections</li>
<li>section is a contiguous set of blocks in a file</li>
<li>each backup piece in a backup set will contain a section</li>
</ul>
<p>&nbsp;</p>
<h4>Example</h4>
<pre>
RMAN> configure device type disk parallelism 2;
RMAN> backup <span class="bgy">SECTION size 200M</span> tablespace example tag "with sections"
</pre>
<pre>
RMAN> list backup summary;

List of Backups
===============
Key     TY LV S Device Type Completion Time #Pieces #Copies Compressed Tag
------- -- -- - ----------- --------------- ------- ------- ---------- ---
5       B  F  A DISK        30-JUL-12       2       1       NO         WITH SECTIONS

RMAN> list backupset 5;

List of Backup Sets
===================

BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
5       Full    67.90M     DISK        00:00:02     30-JUL-12
  List of Datafiles in backup set 5
  File LV Type Ckp SCN    Ckp Time  Name
  ---- -- ---- ---------- --------- ----
  5       Full 1067922    30-JUL-12 /u01/app/oracle/oradata/orcl/example01.dbf

  Backup Set Copy #1 of backup set 5
  Device Type Elapsed Time Completion Time Compressed Tag
  ----------- ------------ --------------- ---------- ---
  DISK        00:00:02     30-JUL-12       NO         WITH SECTIONS

    List of Backup Pieces for backup set 5 Copy #1
    BP Key  Pc# Status      Piece Name
    ------- --- ----------- ----------
    10      1   AVAILABLE   /u01/app/oracle/fast_recovery_area/ORCL/backupset/2012_07_30/o1_mf_nnndf_WITH_SECTIONS_81f93v9f_.bkp
    9       2   AVAILABLE   /u01/app/oracle/fast_recovery_area/ORCL/backupset/2012_07_30/o1_mf_nnndf_WITH_SECTIONS_81f93vh0_.bkp
</pre>
]]></content:encoded>
			<wfw:commentRss>http://d-h-n.de/blog/rman-multisection-backups/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Installing VMWare Tools on Debian 6 (squeeze)</title>
		<link>http://d-h-n.de/blog/installing-vmware-tools-on-debian-6-squeeze</link>
		<comments>http://d-h-n.de/blog/installing-vmware-tools-on-debian-6-squeeze#comments</comments>
		<pubDate>Tue, 17 Jul 2012 15:17:29 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Debian]]></category>
		<category><![CDATA[VMWare]]></category>

		<guid isPermaLink="false">http://localhost/blog/?p=1565</guid>
		<description><![CDATA[Before install VMware Tools on Debian 6 you must install following packages: # aptitude install gcc make linux-headers-$(uname -r)]]></description>
			<content:encoded><![CDATA[<p>Before install VMware Tools on Debian 6 you must install following packages:</p>
<pre>
# aptitude install <span class="bgy">gcc</span> <span class="bgy">make</span> <span class="bgy">linux-headers-$(uname -r)</span>
</pre>
]]></content:encoded>
			<wfw:commentRss>http://d-h-n.de/blog/installing-vmware-tools-on-debian-6-squeeze/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>ORA-00214: inconsistent control files</title>
		<link>http://d-h-n.de/blog/ora-00214-inconsistent-control-files</link>
		<comments>http://d-h-n.de/blog/ora-00214-inconsistent-control-files#comments</comments>
		<pubDate>Fri, 13 Jul 2012 09:53:40 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Oracle]]></category>

		<guid isPermaLink="false">http://localhost/blog/?p=1552</guid>
		<description><![CDATA[when you start the database and got caught with this error message: [oracle@oel62 ~]$ rlwrap sqlplus / as sysdba SQL> startup ORACLE instance started. .. ORA-00214: control file '+DATA/orcl/controlfile/current.276.788282653' version 966 inconsistent with file '+DATA/orcl/controlfile/current.257.788280419' version 964 &#160; SMCMD [+data/orcl/controlfile] > ls -l Type Redund Striped Time Sys Name CONTROLFILE UNPROT FINE JUL 10 15:00:00 [...]]]></description>
			<content:encoded><![CDATA[<p>when you start the database and got caught with this error message:</p>
<pre>
[oracle@oel62 ~]$ rlwrap sqlplus / as sysdba
SQL> startup
ORACLE instance started.

..
<span class="cred">ORA-00214: control file '+DATA/orcl/controlfile/current.276.788282653' version
966 inconsistent with file '+DATA/orcl/controlfile/current.257.788280419'
version 964</span>
</pre>
<p>&nbsp;</p>
<pre>
SMCMD [+data/orcl/controlfile] > ls -l
Type         Redund  Striped  Time             Sys  Name
CONTROLFILE  UNPROT  FINE     JUL 10 15:00:00  Y    current.257.788280419
CONTROLFILE  UNPROT  FINE     JUL 10 15:00:00  Y    current.276.788282653
</pre>
<p>&nbsp;<br />
&nbsp;<br />
<strong>TODO:</strong></p>
<h4>Set parameter control_files with only one control file</h4>
<pre>
SQL> shutdown abort
ORACLE instance shut down.
</pre>
<pre>
SQL> startup nomount
ORACLE instance started.

SQL> alter system set control_files='+DATA/orcl/controlfile/current.257.788280419' scope=spfile;

SQL> shutdown immediate
</pre>
<p>&nbsp;<br />
&nbsp;</p>
<h4>Recover database</h4>
<pre>
RMAN> startup mount
RMAN> recover database;
</pre>
<p>&nbsp;<br />
&nbsp;</p>
<h4>Resetlogs</h4>
<pre>
RMAN> alter database open resetlogs;
</pre>
<pre>
SQL> select status from v$instance;

STATUS
------------
OPEN
</pre>
<p>&nbsp;<br />
&nbsp;</p>
<h4>Remove obsolete control file</h4>
<pre>
SQL> show parameter control_files

NAME				     TYPE	 VALUE
------------------------------------ ----------- ------------------------------
control_files			     string	 +DATA/orcl/controlfile/current
						 .257.788280419
</pre>
<pre>
ASMCMD [+data/orcl/controlfile] > ls -l
Type         Redund  Striped  Time             Sys  Name
CONTROLFILE  UNPROT  FINE     JUL 10 16:00:00  Y    current.257.788280419
CONTROLFILE  UNPROT  FINE     JUL 10 16:00:00  Y    current.276.788282653
</pre>
<pre>
ASMCMD [+data/orcl/controlfile] > rm current.276.788282653
</pre>
<p>&nbsp;<br />
&nbsp;</p>
<h4>Multiplex control files in ASM</h4>
<p>Optional: Multiplex control file: <a href="multiplex-control-files-in-asm" title="Multiplex control file" target="_blank">see here</a></p>
]]></content:encoded>
			<wfw:commentRss>http://d-h-n.de/blog/ora-00214-inconsistent-control-files/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Multiplex control files in ASM</title>
		<link>http://d-h-n.de/blog/multiplex-control-files-in-asm</link>
		<comments>http://d-h-n.de/blog/multiplex-control-files-in-asm#comments</comments>
		<pubDate>Tue, 10 Jul 2012 14:59:00 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Oracle]]></category>

		<guid isPermaLink="false">http://localhost/blog/?p=1536</guid>
		<description><![CDATA[TODO: Multiplex from 1 to 2 control files in ASM &#160; Before There is for example only one control file: SQL> startup nomount SQL> show parameter control_files NAME TYPE VALUE ------------------------------------ ----------- ------------------------------ control_files string +DATA/orcl/controlfile/current .257.788280419 &#160; &#160; Change Now try add the second control file on the same disk group: SQL> alter system [...]]]></description>
			<content:encoded><![CDATA[<p>TODO: Multiplex from 1 to 2 control files in ASM<br />
&nbsp;</p>
<h4>Before</h4>
<p>There is for example only one control file:</p>
<pre>
SQL> startup nomount
SQL> show parameter control_files

NAME				     TYPE	 VALUE
------------------------------------ ----------- ------------------------------
control_files			     string	 +DATA/orcl/controlfile/current
						 .257.788280419
</pre>
<p>&nbsp;<br />
&nbsp;</p>
<h4>Change</h4>
<p>Now try add the second control file on the same disk group:</p>
<pre>
SQL> alter system set control_files='+DATA/orcl/controlfile/current.257.788280419', <span class="bgy">'+DATA'</span> scope=spfile;
SQL> shutdown immediate
</pre>
<pre>
[oracle@oel62 ~]$ rman target /
RMAN> startup nomount
RMAN> <span style="font-weight: bold">restore controlfile from '+DATA/orcl/controlfile/current.257.788280419';</span>

Starting restore at 10-JUL-12
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=24 device type=DISK

channel ORA_DISK_1: copied control file copy
<span class="bgy">output file name=+DATA/orcl/controlfile/current.257.788280419</span>
<span class="bgy">output file name=+DATA/orcl/controlfile/current.276.788286299</span>
Finished restore at 10-JUL-12
</pre>
<p>&nbsp;<br />
&nbsp;</p>
<h4>After</h4>
<p>..and the result is:</p>
<pre>
[oracle@oel62 ~]$ rlwrap sqlplus / as sysdba

SQL> show parameter control_files

NAME				     TYPE	 VALUE
------------------------------------ ----------- ------------------------------
control_files			     string	 +DATA/orcl/controlfile/current
						 .257.788280419, +DATA/orcl/con
						 trolfile/current.276.788286299
SQL> alter database mount;
SQL> alter database open;

SQL> select name from v$controlfile;

NAME
--------------------------------------------------------------------------------
+DATA/orcl/controlfile/current.257.788280419
<span class="bgy">+DATA/orcl/controlfile/current.276.788286299</span>
</pre>
]]></content:encoded>
			<wfw:commentRss>http://d-h-n.de/blog/multiplex-control-files-in-asm/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Move Oracle database from filesystem to ASM</title>
		<link>http://d-h-n.de/blog/move-oracle-database-from-filesystem-to-asm</link>
		<comments>http://d-h-n.de/blog/move-oracle-database-from-filesystem-to-asm#comments</comments>
		<pubDate>Fri, 29 Jun 2012 07:15:08 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Oracle]]></category>

		<guid isPermaLink="false">http://localhost/wordpress/?p=1311</guid>
		<description><![CDATA[Enviroment OS: Oracle Linux 6.2 run on VMWare A simple Oracle 11.2.0.3 database named orcl on filesystem &#160; Steps to move database from file system to a ASM diskgroup Install Grid for Standalone Server on the same machine Modify user oracle Change owner ship of binary oracle Backup database Move spfile to ASM Set relevant [...]]]></description>
			<content:encoded><![CDATA[<ul>Enviroment</p>
<li>OS: Oracle Linux 6.2 run on VMWare</li>
<li>A simple Oracle 11.2.0.3 database named orcl on filesystem</li>
</ul>
<p>&nbsp;</p>
<table class="dottedborder" width="600">
<tr>
<th align="left">
Steps to move database from file system to a ASM diskgroup
</th>
</tr>
<tr>
<td>
<ul>
<li><a href="#install-grid-for-standalone-server-on-the-same-machine">Install Grid for Standalone Server on the same machine</a></li>
<li><a href="#modify-user-oracle">Modify user oracle</a></li>
<li><a href="#change-owner-ship-of-binary-oracle">Change owner ship of binary oracle</a></li>
<li><a href="#backup-database">Backup database</a></li>
<li><a href="#move-spfile">Move spfile to ASM</a></li>
<li><a href="#set-relevant-parameter-point-to-asm">Set relevant Parameter point to ASM</a></li>
<li><a href="#move-control-files">Move control files to ASM</a></li>
<li><a href="#migration-data-files">Migration data files to ASM</a></li>
<li><a href="#migration-temp-file">Migration temp file to ASM</a></li>
<li><a href="#migration-online-redo-log-files">Migration online redo log files to ASM</a></li>
<li><a href="#check">Check</a></li>
<li><a href="#delete-the-remaining-files">Delete the remaining files</a></li>
</ul>
</td>
</tr>
</table>
<p>&nbsp;<br />
&nbsp;<br />
<H3><a name="install-grid-for-standalone-server-on-the-same-machine">Install Grid for Standalone Server on the same machine</a></H3><br />
Create directory grid parallel to directory of oracle and install Grid Infrastructure</p>
<pre>
[root@oel62 ~]#  mkdir -p /u01/app/grid
[root@oel62 ~]# chown grid:oinstall /u01/app/grid
</pre>
<p>more see: <a href="install-oracle-grid-infrastructure-11-2-0-3-0-for-standalone-server-on-oracle-linux-6-2" target="_blank">Install Grid for Standalone Server</a><br />
Additional create 2 ASM disks using UDEV then create a new diskgroup named FRA for Fast Recovery Area. <br />
Howto: see <a href="install-oracle-grid-infrastructure-11-2-0-3-0-for-standalone-server-on-oracle-linux-6-2#setup_udev_disk" target="_blank">here</a><br />
&nbsp;<br />
&nbsp;</p>
<p><H3><a name="modify-user-oracle">Modify user oracle</a></H3><br />
before:</p>
<pre>
[root@oel62 ~]# id oracle
uid=54321(oracle) gid=54321(oinstall) groups=54321(oinstall),54322(dba)
</pre>
<p>run:</p>
<pre>
[root@oel62 ~]# usermod -G oinstall,dba,oper,<span class="bgy">asmdba</span> oracle
</pre>
<p>after:</p>
<pre>
[root@oel62 ~]# id oracle
uid=54321(oracle) gid=54321(oinstall) groups=54321(oinstall),54322(dba),54323(oper),54325(asmdba)
</pre>
<p>for more see: <a href="user-oracle-in-group-asmdba" target="_blank">here</a><br />
&nbsp;<br />
&nbsp;</p>
<p><H3><a name="change-owner-ship-of-binary-oracle">Change owner ship of binary oracle</a></H3></p>
<pre>
[oracle@oel62 ~]$ su - grid
</pre>
<p>before:</p>
<pre>
[grid@oel62 ~]$ ls -l /u01/app/oracle/product/11.2.0/dbhome_1/bin/oracle
-rwsr-s--x 1 <span class="bgy">oracle oinstall</span> 232399123 Jun  5 17:18 /u01/app/oracle/product/11.2.0/dbhome_1/bin/oracle
</pre>
<p>run:</p>
<pre>
[grid@oel62 ~]$ /u01/app/grid/product/11.2.0/grid/bin/setasmgidwrap
o=/u01/app/oracle/product/11.2.0/dbhome_1/bin/oracle
</pre>
<p>after:</p>
<pre>
[grid@oel62 ~]$ ls -l /u01/app/oracle/product/11.2.0/dbhome_1/bin/oracle
-rwsr-s--x 1 <span class="bgy">oracle asmadmin</span> 232399123 Jun  5 17:18 /u01/app/oracle/product/11.2.0/dbhome_1/bin/oracle
</pre>
<p>for more see: <a href="ora-15025-ora-27041-and-setasmgidwrap" target="_blank">here</a><br />
&nbsp;<br />
&nbsp;</p>
<h3><a name="backup-database">Backup database</a></h3>
<pre>
RMAN> startup
RMAN> BACKUP <span class="bgy">AS COPY</span> INCREMENTAL LEVEL 0 DATABASE <span class="bgy">FORMAT '+DATA'</span> TAG 'ORA_ASM_MIGRATION';
RMAN> shutdown immediate
</pre>
<p>This is the crux of the story. We say via RMAN backup the database, but AS COPY(not backupset!), and with the format +DATA which mean all copies are stored in ASM diskgroup DATA <br />
And next we say via command <em>switch database to copy</em>, which means: all data files of the datbase are now their copies!<br />
&nbsp;<br />
&nbsp;<br />
<H3><a name="move-spfile">Move spfile to ASM</a></H3></p>
<pre>
RMAN> startup mount
RMAN> restore spfile to '+DATA/spfileorcl.ora';
RMAN> shutdown immediate
</pre>
<p>Delete file spfileorcl.ora and initorcl.ora in $ORACLE_HOME/dbs/dbs:<br />
Create a new pfile initorcl.ora which points to the spfile in ASM with this line:</p>
<pre>
SPFILE='+DATA/spfileorcl.ora'
</pre>
<p>&nbsp;<br />
&nbsp;<br />
<H3><a name="set-relevant-parameter-point-to-asm">Set relevant parameter point to ASM</a></H3></p>
<pre>
SQL> startup nomount;
SQL> alter system set DB_CREATE_FILE_DEST='+DATA' sid ='*';
SQL> alter system set DB_RECOVERY_FILE_DEST='+FRA' sid='*';
SQL> alter system set CONTROL_FILES=<span class="bgy">'+DATA','+FRA'</span> scope=spfile sid='*';
SQL> shutdown immediate
</pre>
<p>&nbsp;<br />
&nbsp;<br />
<H3><a name="move-control-files">Move control files to ASM</a></H3></p>
<pre>
RMAN> startup nomount
..
RMAN>  restore controlfile from '/u01/app/oracle/oradata/orcl/control01.ctl';

Starting restore at 26-JUN-12
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=24 device type=DISK

channel ORA_DISK_1: copied control file copy
<span class="bgy">output file name=+DATA/orcl/controlfile/current.276.786977643</span>
<span class="bgy">output file name=+FRA/orcl/controlfile/current.256.786977643</span>
Finished restore at 26-JUN-12
</pre>
<p>&nbsp;<br />
&nbsp;<br />
<H3><a name="migration-data-files">Migration data files to ASM</a></H3><br />
All copies of datafiles are ready in ASM disgroup (see <a href="#backup-database">Backup</a>). <br />
Migration data files to ASM is simple: just a switch all data files to their image copies (in ASM diskgroup)!</p>
<pre>
RMAN> alter database mount;
RMAN> <span class="bgy">SWITCH DATABASE TO COPY;</span>
RMAN> recover database;
RMAN> alter database open;
</pre>
<p><a href="what-mean-switch-database-to-copy" title="What mean: SWITCH DATABASE TO COPY?" target="_blank">What mean: SWITCH DATABASE TO COPY?</a>&nbsp;<br />
&nbsp;<br />
&nbsp;<br />
<H3><a name="migration-temp-file">Migration temp file</a></H3></p>
<pre>
SQL> ALTER DATABASE TEMPFILE '/u01/app/oracle/oradata/orcl/temp01.dbf'  DROP;
SQL> ALTER TABLESPACE temp ADD TEMPFILE;
</pre>
<p>&nbsp;<br />
&nbsp;<br />
<H3><a name="migration-online-redo-log-files">Migration online redo log files to ASM</a></H3></p>
<pre>
SQL> select a.group#, a.status, b.member from v$log a,v$logfile b where a.group#=b.group# order by group#;
</pre>
<p>Create new log group:</p>
<pre>
SQL> alter database add logfile group 4 size 50M;
SQL> alter database add logfuile group 5 size 50M;
SQL> alter database add logfile group 6 size 50M;
</pre>
<p>Switch to new log group until old log group 1,2,3 have status INACTIVE:</p>
<pre>
SQL> alter system switch logfile;
SQL> alter system switch logfile;
..
</pre>
<p>Drop old INACTIVE log groups 1,2,3:</p>
<pre>
SQL> alter database drop logfile group 1;
SQL> alter database drop logfile group 2;
SQL> alter database drop logfile group 3;
</pre>
<p>&nbsp;<br />
&nbsp;<br />
<H3><a name="migration-archive-log,-backupset,-copies">Migration archive log, backupset, copies</a></H3></p>
<p>Optionally move archive log, backupset, copies from old FRA</p>
<pre>
RMAN> BACKUP AS COPY ARCHIVELOG ALL DELETE INPUT;
RMAN> BACKUP BACKUPSET ALL DELETE INPUT;
RMAN> BACKUP AS COPY DATAFILECOPY ALL DELETE INPUT;
</pre>
<p>&nbsp;<br />
&nbsp;<br />
<H3><a name="check">Check</a></H3><br />
Where are the files, now?<br />
Control files, Data files, Online Log Files, Tempfile, Archiv Log files?<br />
&nbsp;<br />
Control files:</p>
<pre>
SQL> show parameter control_files

NAME				     TYPE	 VALUE
------------------------------------ ----------- ------------------------------
control_files			     string	 +DATA/orcl/controlfile/current
						 .276.786977643, +FRA/orcl/cont
						 rolfile/current.256.786977643
</pre>
<pre>
SQL> select name from v$controlfile;

NAME
------------------------------------------------------------
+DATA/orcl/controlfile/current.276.786977643
+FRA/orcl/controlfile/current.256.786977643
</pre>
<p>&nbsp;<br />
Online log files:</p>
<pre>
SQL>  select a.group#, a.status, b.member from v$log a,v$logfile b where a.group#=b.group# order by group#;

    GROUP# STATUS	    MEMBER
---------- ---------------- --------------------------------------------------
	 4 INACTIVE	    +DATA/orcl/onlinelog/group_4.266.786980949
	 4 INACTIVE	    +FRA/orcl/onlinelog/group_4.259.786980949
	 5 CURRENT	    +DATA/orcl/onlinelog/group_5.262.786980955
	 5 CURRENT	    +FRA/orcl/onlinelog/group_5.258.786980957
	 6 INACTIVE	    +DATA/orcl/onlinelog/group_6.264.786980963
	 6 INACTIVE	    +FRA/orcl/onlinelog/group_6.257.786980963

6 rows selected.
</pre>
<p>&nbsp;<br />
Datafiles:</p>
<pre>
SQL> select name from v$datafile;

NAME
------------------------------------------------------------
+DATA/orcl/datafile/system.270.786932029
+DATA/orcl/datafile/sysaux.273.786932071
+DATA/orcl/datafile/undotbs1.279.786932105
+DATA/orcl/datafile/users.286.786932109
</pre>
<pre>
SQL> select name from v$datafile_header;

NAME
------------------------------------------------------------
+DATA/orcl/datafile/system.270.786932029
+DATA/orcl/datafile/sysaux.273.786932071
+DATA/orcl/datafile/undotbs1.279.786932105
+DATA/orcl/datafile/users.286.786932109
</pre>
<p>&nbsp;<br />
Tempfile:</p>
<pre>
SQL> select name from v$tempfile;

NAME
----------------------------------------------------------------------
+DATA/orcl/tempfile/temp.265.786980893
</pre>
<p>&nbsp;<br />
&nbsp;<br />
Diskgroup</p>
<pre>
[oracle@oel62 ~]$ su - grid
[grid@oel62 ~]$ rlwrap asmcmd -p
ASMCMD [+] > ls
DATA/
FRA/
</pre>
<p>&nbsp;<br />
Online log files:</p>
<pre>
ASMCMD [+] > find --type onlinelog . *
+DATA/ORCL/ONLINELOG/group_4.266.786980949
+DATA/ORCL/ONLINELOG/group_5.262.786980955
+DATA/ORCL/ONLINELOG/group_6.264.786980963
+FRA/ORCL/ONLINELOG/group_4.259.786980949
+FRA/ORCL/ONLINELOG/group_5.258.786980957
+FRA/ORCL/ONLINELOG/group_6.257.786980963
</pre>
<p>&nbsp;<br />
Control files:</p>
<pre>
ASMCMD [+] > find --type controlfile . *
+DATA/ORCL/CONTROLFILE/Backup.260.786932109
+DATA/ORCL/CONTROLFILE/current.276.786977643
+FRA/ORCL/CONTROLFILE/current.256.786977643
</pre>
<p>&nbsp;<br />
Datafiles:</p>
<pre>
ASMCMD [+] > find --type datafile . *
+DATA/ORCL/DATAFILE/SYSAUX.273.786932071
+DATA/ORCL/DATAFILE/SYSTEM.270.786932029
+DATA/ORCL/DATAFILE/UNDOTBS1.279.786932105
+DATA/ORCL/DATAFILE/USERS.286.786932109
+FRA/ORCL/DATAFILE/SYSAUX.263.786981205
+FRA/ORCL/DATAFILE/SYSTEM.264.786981149
+FRA/ORCL/DATAFILE/UNDOTBS1.262.786981251
+FRA/ORCL/DATAFILE/USERS.261.786981257
</pre>
<p>&nbsp;<br />
Archive log files:</p>
<pre>
ASMCMD [+] > find --type archivelog . *
+FRA/ORCL/ARCHIVELOG/2012_06_26/thread_1_seq_10.271.786981119
+FRA/ORCL/ARCHIVELOG/2012_06_26/thread_1_seq_11.270.786981119
+FRA/ORCL/ARCHIVELOG/2012_06_26/thread_1_seq_4.267.786981111
+FRA/ORCL/ARCHIVELOG/2012_06_26/thread_1_seq_5.266.786981113
+FRA/ORCL/ARCHIVELOG/2012_06_26/thread_1_seq_6.265.786981113
+FRA/ORCL/ARCHIVELOG/2012_06_26/thread_1_seq_7.274.786981115
+FRA/ORCL/ARCHIVELOG/2012_06_26/thread_1_seq_8.273.786981115
+FRA/ORCL/ARCHIVELOG/2012_06_26/thread_1_seq_9.272.786981117
</pre>
<p>&nbsp;<br />
Tempfiles:</p>
<pre>
ASMCMD [+] > find --type tempfile . *
+DATA/ORCL/TEMPFILE/TEMP.265.786980893
</pre>
<p>&nbsp;<br />
&nbsp;<br />
<H3><a name="delete-the-remaining-files">Delete the remaining files</a></H3></p>
<pre>
[oracle@oel62 ~]$ ls -r /u01/app/oracle/oradata/orcl/
temp01.dbf  redo03.log  redo02.log  redo01.log  control01.ctl
[oracle@oel62 ~]$ ls -r /u01/app/oracle/fast_recovery_area/orcl/
control02.ctl
</pre>
<p>&nbsp;<br />
&nbsp;<br />
Source: <a href="http://localhost/oradoc/server.112/e16102/asm_rman.htm#i1022780" target="_blank">http://localhost/oradoc/server.112/e16102/asm_rman.htm#i1022780</a></p>
]]></content:encoded>
			<wfw:commentRss>http://d-h-n.de/blog/move-oracle-database-from-filesystem-to-asm/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>What mean: SWITCH DATABASE TO COPY?</title>
		<link>http://d-h-n.de/blog/what-mean-switch-database-to-copy</link>
		<comments>http://d-h-n.de/blog/what-mean-switch-database-to-copy#comments</comments>
		<pubDate>Tue, 26 Jun 2012 09:43:14 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Oracle]]></category>

		<guid isPermaLink="false">http://localhost/blog/?p=1467</guid>
		<description><![CDATA[Let create image copies of datafiles: RMAN> startup RMAN> BACKUP AS COPY INCREMENTAL LEVEL 0 DATABASE FORMAT '+DATA' TAG 'ORA_ASM_MIGRATION'; Starting backup at 26-JUN-12 using target database control file instead of recovery catalog allocated channel: ORA_DISK_1 channel ORA_DISK_1: SID=42 device type=DISK channel ORA_DISK_1: starting datafile copy input datafile file number=00001 name=/u01/app/oracle/oradata/orcl/system01.dbf output file name=+DATA/orcl/datafile/system.270.786932029 tag=ORA_ASM_MIGRATION [...]]]></description>
			<content:encoded><![CDATA[<p>Let create image copies of datafiles:</p>
<pre>
RMAN> startup
RMAN> BACKUP <span class="bgy">AS COPY</span> INCREMENTAL LEVEL 0 DATABASE FORMAT '+DATA' TAG 'ORA_ASM_MIGRATION';
Starting backup at 26-JUN-12
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=42 device type=DISK
channel ORA_DISK_1: starting datafile copy
input datafile file number=00001 name=/u01/app/oracle/oradata/orcl/system01.dbf
output file name=+DATA/orcl/datafile/system.270.786932029 tag=ORA_ASM_MIGRATION RECID=1 STAMP=786932063
.....
</pre>
<p>&nbsp;<br />
&nbsp;</p>
<h3>Before switch</h3>
<table class="dottedborder">
<tr>
<th>Datafiles</th>
<th>Image copies</th>
</tr>
<tr>
<td valign="top">
<pre>
SQL> select name from v$datafile;

NAME
--------------------------------------------
/u01/app/oracle/oradata/orcl/system01.dbf
/u01/app/oracle/oradata/orcl/sysaux01.dbf
/u01/app/oracle/oradata/orcl/undotbs01.dbf
/u01/app/oracle/oradata/orcl/users01.dbf
</pre>
</td>
<td>
<pre>
RMAN> list copy of database;

List of Datafile Copies
=======================

Key     File S Completion Time Ckp SCN    Ckp Time
------- ---- - --------------- ---------- ---------------
1       1    A 26-JUN-12       1034213    26-JUN-12
        Name: +DATA/orcl/datafile/system.270.786932029
        Tag: ORA_ASM_MIGRATION

2       2    A 26-JUN-12       1035262    26-JUN-12
        Name: +DATA/orcl/datafile/sysaux.273.786932071
        Tag: ORA_ASM_MIGRATION

3       3    A 26-JUN-12       1036534    26-JUN-12
        Name: +DATA/orcl/datafile/undotbs1.279.786932105
        Tag: ORA_ASM_MIGRATION

5       4    A 26-JUN-12       1036713    26-JUN-12
        Name: +DATA/orcl/datafile/users.286.786932109
        Tag: ORA_ASM_MIGRATION
</pre>
</td>
</tr>
<tr>
<td>the data files are in OS filesystem</td>
<td>and the image copies are in ASM diskgroup</td>
</tr>
</table>
<p>&nbsp;<br />
&nbsp;</p>
<h3>Now run SWITCH DATABASE TO COPY</h3>
<pre>
RMAN> shutdown immediate
RMAN> startup mount
RMAN> <span class="bgy">switch database to copy;</span>

datafile 1 switched to datafile copy "+DATA/orcl/datafile/system.270.786932029"
datafile 2 switched to datafile copy "+DATA/orcl/datafile/sysaux.273.786932071"
datafile 3 switched to datafile copy "+DATA/orcl/datafile/undotbs1.279.786932105"
datafile 4 switched to datafile copy "+DATA/orcl/datafile/users.286.786932109"
</pre>
<p>&nbsp;<br />
&nbsp;</p>
<h3>After switch</h3>
<table class="dottedborder">
<tr>
<th>Datafiles</th>
<th>Image copies</th>
</tr>
<tr>
<td valign="top">
<pre>
SQL> select name from v$datafile;

NAME
------------------------------------------
+DATA/orcl/datafile/system.270.786932029
+DATA/orcl/datafile/sysaux.273.786932071
+DATA/orcl/datafile/undotbs1.279.786932105
+DATA/orcl/datafile/users.286.786932109
</pre>
</td>
<td>
<pre>
RMAN> list copy of database;

List of Datafile Copies
=======================

Key     File S Completion Time Ckp SCN    Ckp Time
------- ---- - --------------- ---------- ---------------
6       1    A 26-JUN-12       1037282    26-JUN-12
        Name: /u01/app/oracle/oradata/orcl/system01.dbf

7       2    A 26-JUN-12       1037282    26-JUN-12
        Name: /u01/app/oracle/oradata/orcl/sysaux01.dbf

8       3    A 26-JUN-12       1037282    26-JUN-12
        Name: /u01/app/oracle/oradata/orcl/undotbs01.dbf

9       4    A 26-JUN-12       1037282    26-JUN-12
        Name: /u01/app/oracle/oradata/orcl/users01.dbf
</pre>
</td>
</tr>
<tr>
<td>the data files are now in ASM diskgroup</td>
<td>and image copies are now the old datafiles OS filesystem</td>
</tr>
</table>
<p>&nbsp;<br />
&nbsp;</p>
<h4>Conclusion</h4>
<p>What mean SWITCH DATABASE TO COPY? </p>
<p><a href="http://docs.oracle.com/cd/B28359_01/backup.111/b28273/rcmsynta049.htm">http://docs.oracle.com/cd/B28359_01/backup.111/b28273/rcmsynta049.htm</a><br />
<em>Renames the datafiles and control files to use the filenames of image copies of these files. <br />
RMAN switches to the latest image copy of each database file.<br />
After a database switch, RMAN considers the previous database files as datafile copies.</em><br />
&nbsp;<br />
Short: SWITCH DATABASE TO COPY mean: Switch all data files to their images copies<br />
&nbsp;<br />
&nbsp;<br />
..and what is when we run <code>switch database to copy</code> again?<br />
Correct! We become the state <em>Before</em> again.<br />
The datafiles are in files system and their images are in ASM as before. </p>
<p>Just playing around with <code>switch database to copy</code>!</p>
]]></content:encoded>
			<wfw:commentRss>http://d-h-n.de/blog/what-mean-switch-database-to-copy/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>ORA-15025, ORA-27041 and setasmgidwrap</title>
		<link>http://d-h-n.de/blog/ora-15025-ora-27041-and-setasmgidwrap</link>
		<comments>http://d-h-n.de/blog/ora-15025-ora-27041-and-setasmgidwrap#comments</comments>
		<pubDate>Tue, 19 Jun 2012 08:02:39 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Oracle]]></category>

		<guid isPermaLink="false">http://localhost/wordpress/?p=1299</guid>
		<description><![CDATA[With job role separation(oracle, grid) when run manual create database or when try move a database to ASM like here restore conrolfile to ASM: [oracle@oel62 ~]$ rman target / .. RMAN> restore controlfile from '/u01/app/oracle/oradata/orcl/control01.ctl'; .. RMAN-03002: failure of restore command at 06/13/2012 11:55:21 RMAN-10038: database session for channel ORA_DISK_1 terminated unexpectedly &#160; and in [...]]]></description>
			<content:encoded><![CDATA[<p>With job role separation(oracle, grid) when run manual create database or when try move a database to ASM<br />
like here restore conrolfile to ASM:</p>
<pre>
[oracle@oel62 ~]$ rman target /
..
RMAN> restore controlfile from '/u01/app/oracle/oradata/orcl/control01.ctl';
..
RMAN-03002: failure of restore command at 06/13/2012 11:55:21
RMAN-10038: database session for channel ORA_DISK_1 terminated unexpectedly
</pre>
<p>&nbsp;<br />
and in /u01/app/oracle/diag/rdbms/orcl/orcl/trace/alert_orcl.log:</p>
<pre>
<span class="cred">ORA-15025: could not open disk "/dev/asm-disk1"
ORA-27041: unable to open file
Linux-x86_64 Error: 13: Permission denied
Additional information: 9</span>
ORA-15025: could not open disk "/dev/asm-disk2"
ORA-27041: unable to open file
Linux-x86_64 Error: 13: Permission denied
Additional information: 9
SUCCESS: diskgroup DATA was mounted
</pre>
<p>&nbsp;<br />
&nbsp;<br />
<strong>Solution:</strong><br />
Change owner of binary $ORACLE_HOME/bin/oracle (of user oracle):<br />
&nbsp;<br />
Before:</p>
<pre>
[grid@oel62 ~]$ ls -l /u01/app/oracle/product/11.2.0/dbhome_1/bin/oracle
-rwsr-s--x 1 <span class="bgy">oracle oinstall</span> 232399123 Jun  5 17:18 /u01/app/oracle/product/11.2.0/dbhome_1/bin/oracle
</pre>
<p>Run:</p>
<pre>
[grid@oel62 ~]/u01/app/grid/product/11.2.0/grid/bin/<span class="bgy">setasmgidwrap</span>
o=/u01/app/oracle/product/11.2.0/dbhome_1/bin/oracle
</pre>
<p>After:</p>
<pre>
[grid@oel62 ~]$ ls -l /u01/app/oracle/product/11.2.0/dbhome_1/bin/oracle
-rwsr-s--x 1 <span class="bgy">oracle asmadmin</span> 232399123 Jun  5 17:18 /u01/app/oracle/product/11.2.0/dbhome_1/bin/oracle
</pre>
]]></content:encoded>
			<wfw:commentRss>http://d-h-n.de/blog/ora-15025-ora-27041-and-setasmgidwrap/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
