<?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>Dev&#039;s Weblog</title>
	<atom:link href="http://www.sysdbaonline.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.sysdbaonline.com</link>
	<description>Gateway to the Database Solutions</description>
	<lastBuildDate>Tue, 21 Feb 2012 14:25:01 +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>Grid Control 10.2.0.5 &#8211; Agent issue</title>
		<link>http://www.sysdbaonline.com/2012/02/grid-control-10-2-0-5-agent-issue/</link>
		<comments>http://www.sysdbaonline.com/2012/02/grid-control-10-2-0-5-agent-issue/#comments</comments>
		<pubDate>Tue, 21 Feb 2012 14:25:01 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Oracle]]></category>

		<guid isPermaLink="false">http://www.sysdbaonline.com/?p=1249</guid>
		<description><![CDATA[Problem: I was not able to see few databases on my grid control portal though the agent was installed on the box where the databases were running. When I looked at the OMS trace file under $OMS_HOME/sysman/logs, I saw the following error. 2012-02-21 01:28:01,575 [AJPRequestHandler-ApplicationServerThread-9] ERROR eml.OMSHandshake processFailure.843 - OMSHandshake failed. (AGENT URL = https://10.0.0.2:3872/emd/main/)(ERROR [...]]]></description>
			<content:encoded><![CDATA[<!-- google_ad_section_start --><p><strong>Problem:</strong></p>
<p>I was not able to see few databases on my grid control portal though the agent was installed on the box where the databases were running.</p>
<p>When I looked at the OMS trace file under $OMS_HOME/sysman/logs, I saw the following error.</p>
<pre class="brush: text; gutter: false">2012-02-21 01:28:01,575 [AJPRequestHandler-ApplicationServerThread-9] ERROR eml.OMSHandshake processFailure.843 - OMSHandshake failed.</pre>
<pre class="brush: text; gutter: false">(AGENT URL = https://10.0.0.2:3872/emd/main/)(ERROR = KEY_MISMATCH)</pre>
<p><strong>Solution:</strong></p>
<p>I logged into the box and tried to upload the pending XML files using the following command.</p>
<pre class="brush: shell; gutter: false">cd $AGENT_HOME
cd bin
./emctl upload agent</pre>
<pre class="brush: shell; gutter: false">but it failed with the following error.</pre>
<pre class="brush: shell; gutter: false">EMD upload error: uploadXMLFiles skipped :: OMS version not checked yet..</pre>
<pre class="brush: shell; gutter: false">I then thought of re-securing the agent.</pre>
<pre class="brush: shell; gutter: false">./emctl secure agent

Agent Registration Password:**********

The Agent is secured.</pre>
<pre class="brush: shell; gutter: false">After securing the agent again , I was able to upload the pending XML files.</pre>
<!-- google_ad_section_end -->]]></content:encoded>
			<wfw:commentRss>http://www.sysdbaonline.com/2012/02/grid-control-10-2-0-5-agent-issue/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Oracle &#8211; Restrict User login from particular IP Address</title>
		<link>http://www.sysdbaonline.com/2012/01/oracle-restrict-user-login-from-particular-ip-address/</link>
		<comments>http://www.sysdbaonline.com/2012/01/oracle-restrict-user-login-from-particular-ip-address/#comments</comments>
		<pubDate>Tue, 31 Jan 2012 15:19:11 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Oracle]]></category>
		<category><![CDATA[Oracle DB]]></category>
		<category><![CDATA[Blocking Orace user]]></category>
		<category><![CDATA[Blocking through SQLNET.ORA]]></category>
		<category><![CDATA[Blocking through triggers]]></category>
		<category><![CDATA[IP Address Blocking]]></category>

		<guid isPermaLink="false">http://www.sysdbaonline.com/?p=1217</guid>
		<description><![CDATA[Problem : I was asked to load new data into the database and I didn&#8217;t want users/applications to connect when I am loading the data. Solution : I had the following solutions in my mind. Solution 1:Only allow login from the particular host. Open the SQLNET.ORA from $ORACLE_HOME/network/admin and add following parameters. tcp.validnode_checking = yes [...]]]></description>
			<content:encoded><![CDATA[<!-- google_ad_section_start --><p>Problem :</p>
<p>I was asked to load new data into the database and I didn&#8217;t want users/applications to connect when I am loading the data.</p>
<p>Solution :</p>
<p>I had the following solutions in my mind.</p>
<p>Solution 1:Only allow login from the particular host.</p>
<ul>
<li>Open the SQLNET.ORA from $ORACLE_HOME/network/admin and add following parameters.</li>
</ul>
<div>
<pre class="brush: shell; gutter: false">tcp.validnode_checking = yes
tcp.invited_nodes = (localhost, 10.103.119.182)</pre>
<ul>
<li>Reload the listener.</li>
</ul>
<div>
<pre class="brush: shell; gutter: false">$cd $ORACLE_HOME/bin

$./lsnrctl reload</pre>
</div>
<div>Now Oracle will only allow the connections from the machine with 10.103.119.182 IP Address.It will not even allow the sys or system user so make sure you have the SSH access to the database machine because if something goes wrong than you can SSH into the box and change the sqlnet.ora accordingly.</div>
<div>Advantages:</div>
<div>
<ul>
<li>No database configuration needs to be changed.</li>
<li>Easy to toggle the setting.</li>
</ul>
</div>
<div>Disadvantages :</div>
<div>
<ul>
<li>It applies to all the users including SYS and SYSTEM.</li>
<li>SQLNET.ORA changes the system wide setting so it will be applied to all the database which are registered with the listener.</li>
</ul>
</div>
<div>Solution 2 : Allow particular host using the Database triggers.</div>
<div>
<ul>
<li>Write a Logon Database trigger which will allow the users/applications from the particular hosts.</li>
</ul>
<div>
<pre class="brush: sql; gutter: false">CREATE OR REPLACE TRIGGER restricted_logon
AFTER LOGON ON DATABASE
BEGIN
IF SYS_CONTEXT('USERENV','IP_ADDRESS') not in ('10.103.119.183', '10.103.119.184') THEN
RAISE_APPLICATION_ERROR(-20003,'You are not allowed to connect to the database');
END IF;
END;
/</pre>
<ul>
<li>The user will get the following error if his host is not allowed.</li>
</ul>
<div>
<pre class="brush: sql; gutter: false">ORA-20003: You are not allowed to connect to the database</pre>
<ul>
<li>Please disable the trigger once the data loading is done.</li>
</ul>
<div>
<pre class="brush: sql; gutter: false">alter trigger restricted_logon disable;</pre>
</div>
</div>
</div>
</div>
</div>
<div>Advantages :</div>
<div>
<ul>
<li>The trigger works at the database level so it wont affect the other databases.</li>
<li>Easy to disable/enable trigger.</li>
</ul>
<div>Disadvantages :</div>
</div>
<div>
<ul>
<li>The database trigger will have to created once and it may not be supported or allowed.</li>
<li>The triggers won&#8217;t be fired for the uses who has the DBA privileges/role.</li>
</ul>
</div>
<!-- google_ad_section_end -->]]></content:encoded>
			<wfw:commentRss>http://www.sysdbaonline.com/2012/01/oracle-restrict-user-login-from-particular-ip-address/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>MySQL 5.5 &#8211; ROOT Password issue</title>
		<link>http://www.sysdbaonline.com/2012/01/mysql-5-5-root-password-issue/</link>
		<comments>http://www.sysdbaonline.com/2012/01/mysql-5-5-root-password-issue/#comments</comments>
		<pubDate>Tue, 17 Jan 2012 13:52:15 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[MySQL]]></category>
		<category><![CDATA[empty user table]]></category>
		<category><![CDATA[mysql]]></category>

		<guid isPermaLink="false">http://www.sysdbaonline.com/?p=1209</guid>
		<description><![CDATA[Problem: I tried to upgrade the MySQL 5.1 to MySQL 5.5 and messed up the installation somehow ,so I deleted the data directory for mysql (/var/lib/mysql) and installed the MySQL 5.5 fresh using the RPMs but after the installation I was not able to login as a MySQL root user. I was getting the following [...]]]></description>
			<content:encoded><![CDATA[<!-- google_ad_section_start --><p><strong>Problem:</strong></p>
<p>I tried to upgrade the MySQL 5.1 to MySQL 5.5 and messed up the installation somehow ,so I deleted the data directory for mysql (/var/lib/mysql) and installed the MySQL 5.5 fresh using the RPMs but after the installation I was not able to login as a MySQL root user.</p>
<p>I was getting the following error.</p>
<pre class="brush: shell; gutter: false">ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)</pre>
<p><strong>Solution:</strong></p>
<p>The only way to reset the root user password is start the MySQL in the safe mode where it will not ask for the password so that you can login and change the password of existing user.</p>
<p>I started the MySQL daemon in a safe mode using the following command.</p>
<pre class="brush: shell; gutter: false">#mysqld_safe --skip-grant-tables</pre>
<pre class="brush: shell; gutter: false">Logged into the MySQL ,</pre>
<pre class="brush: shell; gutter: false">#mysql -u root</pre>
<pre class="brush: sql; gutter: false">mysql&gt; show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
| test               |
+--------------------+
4 rows in set (0.00 sec)

mysql&gt; use mysql;</pre>
<pre class="brush: sql; gutter: false">Database changed</pre>
<pre class="brush: sql; gutter: false">mysql&gt; select * from user;</pre>
<pre class="brush: sql; gutter: false">0 row in set (0.00 sec)</pre>
<pre>So the mysql.user table was empty and because of that it was not allowing the root user to login.
So I had to insert the root account entry manually in order to allow root login.</pre>
<pre class="brush: sql; gutter: false">mysql&gt; INSERT INTO user VALUES ('localhost','root',password('oracle'),'Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y', 'Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','','',0,0,0,0,NULL,NULL);
Query OK, 1 row affected (0.00 sec)</pre>
<pre class="brush: sql; gutter: false"></pre>
<pre class="brush: sql; gutter: false">After that entry , I was able to login as a root user.</pre>
<pre class="brush: sql; gutter: false">mysql&gt; select * from user \G;
*************************** 1. row ***************************
                  Host: localhost
                  User: root
              Password: *2447D497B9A6A15F2776055CB2D1E9F86758182F
           Select_priv: Y
           Insert_priv: Y
           Update_priv: Y
           Delete_priv: Y
           Create_priv: Y
             Drop_priv: Y
           Reload_priv: Y
         Shutdown_priv: Y
          Process_priv: Y
             File_priv: Y
            Grant_priv: Y
       References_priv: Y
            Index_priv: Y
            Alter_priv: Y
          Show_db_priv: Y
            Super_priv: Y
 Create_tmp_table_priv: Y
      Lock_tables_priv: Y
          Execute_priv: Y
       Repl_slave_priv: Y
      Repl_client_priv: Y
      Create_view_priv: Y
        Show_view_priv: Y
   Create_routine_priv: Y
    Alter_routine_priv: Y
      Create_user_priv: Y
            Event_priv: Y
          Trigger_priv: Y
Create_tablespace_priv: Y
              ssl_type:
            ssl_cipher:
           x509_issuer:
          x509_subject:
         max_questions: 0
           max_updates: 0
       max_connections: 0
  max_user_connections: 0
                plugin: NULL
 authentication_string: NULL
1 row in set (0.00 sec)</pre>
<!-- google_ad_section_end -->]]></content:encoded>
			<wfw:commentRss>http://www.sysdbaonline.com/2012/01/mysql-5-5-root-password-issue/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Oracle 11G &#8211; Active Duplicate Database</title>
		<link>http://www.sysdbaonline.com/2011/12/oracle-11g-active-duplicate-database/</link>
		<comments>http://www.sysdbaonline.com/2011/12/oracle-11g-active-duplicate-database/#comments</comments>
		<pubDate>Wed, 14 Dec 2011 11:08:00 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[11G]]></category>
		<category><![CDATA[Oracle]]></category>
		<category><![CDATA[Oracle DB]]></category>

		<guid isPermaLink="false">http://www.sysdbaonline.com/?p=1199</guid>
		<description><![CDATA[Problem : I was asked to duplicate the production database (11.2.0.2) on the same machine which will be used as a test instance. Solution: With 11G there are many ways to duplicate the database. Manual Duplicate &#8211; Where you need to take the backup of production system and move the backup pieces to the machine [...]]]></description>
			<content:encoded><![CDATA[<!-- google_ad_section_start --><p><strong>Problem :</strong></p>
<p>I was asked to duplicate the production database (11.2.0.2) on the same machine which will be used as a test instance.</p>
<p><strong>Solution:</strong></p>
<p>With 11G there are many ways to duplicate the database.</p>
<ol>
<li>Manual Duplicate &#8211; Where you need to take the backup of production system and move the backup pieces to the machine where want to duplicate the database.</li>
<li>Duplicate database from location &#8211; with 11GR2 you can use this option to duplicate the production database from its backup.The main advantage of this method is that while duplicating the database you don&#8217;t need to connect to production system at all.</li>
<li>Active Duplicate &#8211; With this method you need to have session with production and to be cloned database before you can perform the duplication.The advantage of this method is that you do not need to have production database&#8217;s backup beforehand.The duplication process with take the backup and will get rid of it once the duplication is done.</li>
</ol>
<div>I opted for the Active duplication.Here are the steps which I performed to duplicate the database.</div>
<div>My environment.</div>
<div style="text-align: left;"></p>
<table class="wptable rowstyle-alt" id="wptable-4"  cellspacing="1">
	<thead>
	<tr>
		<th class="sortable" style="width:100px" align="center">Production DB</th>
		<th class="sortable" style="width:100px" align="center">Clone DB</th>
	</tr>
	</thead>
	<tr>
		<td style="width:100px" align="center">ORCL11202</td>
		<td style="width:100px" align="center">PRIMDB</td>
	</tr>
</table><p>
</div>
<div>
<ul>
<li><strong>Step 1 : Create TNS Aliases</strong></li>
</ul>
</div>
<div><strong> </strong></div>
<div>Create tns alias entries into $ORACLE_HOME/network/admin/tnsnames.ora  for both Production and clone database.</div>
<div>
<pre class="brush: shell; gutter: false">ORCL11202 =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = meteor)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = orcl11202)
    )
  )

PRIMDB =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = meteor)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = PRIMDB)
    )
  )</pre>
<ul>
<li><strong><strong>Step 2 : Create Static Registration for both databases in the listner.ora </strong></strong></li>
</ul>
<div>
<pre class="brush: shell; gutter: false">LISTENER =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = TCP)(HOST = meteor)(PORT = 1521))
    )
  )

SID_LIST_LISTENER =
  (SID_LIST =
    (SID_DESC =
          (GLOBAL_DBNAME = ORCL11202)
          (ORACLE_HOME = /export/home/oracle/product/11.2.0.2/dbhome_1)
          (SID_NAME = ORCL11202)
    )
    (SID_DESC =
             (GLOBAL_DBNAME = PRIMDB)
             (ORACLE_HOME = /export/home/oracle/product/11.2.0.2/dbhome_1)
             (SID_NAME = PRIMDB)
   )
  )</pre>
<ul>
<li><strong>Step 3 : Create password file and pfile for clone database.</strong></li>
</ul>
</div>
<div>Create password for the clone database.</div>
<div>
<pre class="brush: shell; gutter: false">$orapwd file=$ORACLE_HOME/dbs/orapwPRIMDB password=password entries=10</pre>
</div>
<div>Create a pfile $ORACLE_HOME/dbs/initPRIMDB.ora with  following parameters.</div>
</div>
<div>
<pre class="brush: shell; gutter: false">*.db_name='PRIMDB'
*.diagnostic_dest=/export/home/oracle</pre>
<pre class="brush: shell; gutter: false"></pre>
<ul style="font-weight: bold;">
<li><strong>Step 4 : Start Clone database in the nomount mode.</strong></li>
</ul>
<div>
<pre class="brush: shell; gutter: false">$export ORACLE_SID=PRIMDB</pre>
<pre class="brush: shell; gutter: false">$sqlplus / as sysdba</pre>
<pre class="brush: shell; gutter: false">SQL&gt;startup nomount;
ORACLE instance started.

Total System Global Area  217219072 bytes
Fixed Size                  2156896 bytes
Variable Size             159389344 bytes
Database Buffers           50331648 bytes
Redo Buffers                5341184 bytes</pre>
<ul>
<li><strong>Step 5 : Create necessary directories for the clone database.</strong></li>
</ul>
<div>
<pre class="brush: shell; gutter: false">$mkdir /u02/database/PRIMDB

$mkdir /u02/fra/PRIMDB</pre>
<ul>
<li><strong>Step 6 : Connect to Production instance and auxiliary instance using RMAN.</strong></li>
</ul>
<div>
<pre class="brush: shell; gutter: false">$rman target sys/password@orcl11202 auxiliary sys/password@PRIMDB</pre>
<pre>Recovery Manager: Release 11.2.0.2.0 - Production on Wed Dec 14 10:31:25 2011

Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved.

connected to target database: ORCL1120 (DBID=3456964407)
connected to auxiliary database: PRIMDB (not mounted)</pre>
<ul>
<li><strong>Step 7 : Start the Duplication process.</strong></li>
</ul>
<div>
<pre class="brush: sql; gutter: false">run {
allocate channel C1 type disk;
allocate auxiliary channel DUP type disk;
duplicate target database
to PRIMDB
from active database
spfile
SET MEMORY_TARGET="270M"
set db_unique_name='PRIMDB'
set db_file_name_convert='/u02/database/orcl11202','/u02/database/PRIMDB'
set log_file_name_convert='/u02/database/orcl11202','/u02/database/PRIMDB'
set control_files='/u02/database/PRIMDB/control01.ctl','/u02/database/PRIMDB/control02.ctl'
set log_archive_max_processes='5'
set log_archive_dest_1='LOCATION=/u02/fra VALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=PRIMDB'
;
}</pre>
<ul>
<li><strong>Step 8 : Monitor the duplication process.</strong></li>
</ul>
<div>
<pre class="brush: sql; gutter: false">using target database control file instead of recovery catalog
allocated channel: C1
channel C1: SID=143 device type=DISK

allocated channel: DUP
channel DUP: SID=96 device type=DISK

Starting Duplicate Db at 14-DEC-11

contents of Memory Script:
{
   backup as copy reuse
   targetfile  '/export/home/oracle/product/11.2.0.2/dbhome_1/dbs/spfileorcl11202.ora' auxiliary format
 '/export/home/oracle/product/11.2.0.2/dbhome_1/dbs/spfilePRIMDB.ora'   ;
   sql clone "alter system set spfile= ''/export/home/oracle/product/11.2.0.2/dbhome_1/dbs/spfilePRIMDB.ora''";
}
executing Memory Script

Starting backup at 14-DEC-11
Finished backup at 14-DEC-11

sql statement: alter system set spfile= ''/export/home/oracle/product/11.2.0.2/dbhome_1/dbs/spfilePRIMDB.ora''

contents of Memory Script:
{
   sql clone "alter system set  db_name =
 ''PRIMDB'' comment=
 ''duplicate'' scope=spfile";
   sql clone "alter system set  db_unique_name =
 ''PRIMDB'' comment=
 ''duplicate'' scope=spfile";
   sql clone "alter system set  MEMORY_TARGET =
 270M comment=
 '''' scope=spfile";
   sql clone "alter system set  db_unique_name =
 ''PRIMDB'' comment=
 '''' scope=spfile";
   sql clone "alter system set  db_file_name_convert =
 ''/u02/database/orcl11202'', ''/u02/database/PRIMDB'' comment=
 '''' scope=spfile";
   sql clone "alter system set  log_file_name_convert =
 ''/u02/database/orcl11202'', ''/u02/database/PRIMDB'' comment=
 '''' scope=spfile";
   sql clone "alter system set  control_files =
 ''/u02/database/PRIMDB/control01.ctl'', ''/u02/database/PRIMDB/control02.ctl'' comment=
 '''' scope=spfile";
   sql clone "alter system set  log_archive_max_processes =
 5 comment=
 '''' scope=spfile";
   sql clone "alter system set  log_archive_dest_1 =
 ''LOCATION=/u02/fra VALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=PRIMDB'' comment=
 '''' scope=spfile";
   shutdown clone immediate;
   startup clone nomount;
}
executing Memory Script

sql statement: alter system set  db_name =  ''PRIMDB'' comment= ''duplicate'' scope=spfile

sql statement: alter system set  db_unique_name =  ''PRIMDB'' comment= ''duplicate'' scope=spfile

sql statement: alter system set  MEMORY_TARGET =  270M comment= '''' scope=spfile

sql statement: alter system set  db_unique_name =  ''PRIMDB'' comment= '''' scope=spfile

sql statement: alter system set  db_file_name_convert =  ''/u02/database/orcl11202'', ''/u02/database/PRIMDB'' comment= '''' scope=spfile

sql statement: alter system set  log_file_name_convert =  ''/u02/database/orcl11202'', ''/u02/database/PRIMDB'' comment= '''' scope=spfile

sql statement: alter system set  control_files =  ''/u02/database/PRIMDB/control01.ctl'', ''/u02/database/PRIMDB/control02.ctl'' comment= '''' scope=spfile

sql statement: alter system set  log_archive_max_processes =  5 comment= '''' scope=spfile

sql statement: alter system set  log_archive_dest_1 =  ''LOCATION=/u02/fra VALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=PRIMDB'' comment= '''' scope=spfile

Oracle instance shut down

connected to auxiliary database (not started)
Oracle instance started

Total System Global Area     284008448 bytes

Fixed Size                     2157624 bytes
Variable Size                218108872 bytes
Database Buffers              58720256 bytes
Redo Buffers                   5021696 bytes
allocated channel: DUP
channel DUP: SID=135 device type=DISK

contents of Memory Script:
{
   sql clone "alter system set  db_name =
 ''ORCL1120'' comment=
 ''Modified by RMAN duplicate'' scope=spfile";
   sql clone "alter system set  db_unique_name =
 ''PRIMDB'' comment=
 ''Modified by RMAN duplicate'' scope=spfile";
   shutdown clone immediate;
   startup clone force nomount
   backup as copy current controlfile auxiliary format  '/u02/database/PRIMDB/control01.ctl';
   restore clone controlfile to  '/u02/database/PRIMDB/control02.ctl' from
 '/u02/database/PRIMDB/control01.ctl';
   alter clone database mount;
}
executing Memory Script

sql statement: alter system set  db_name =  ''ORCL1120'' comment= ''Modified by RMAN duplicate'' scope=spfile

sql statement: alter system set  db_unique_name =  ''PRIMDB'' comment= ''Modified by RMAN duplicate'' scope=spfile

Oracle instance shut down

Oracle instance started

Total System Global Area     284008448 bytes

Fixed Size                     2157624 bytes
Variable Size                222303176 bytes
Database Buffers              54525952 bytes
Redo Buffers                   5021696 bytes
allocated channel: DUP
channel DUP: SID=134 device type=DISK

Starting backup at 14-DEC-11
channel C1: starting datafile copy
copying current control file
output file name=/u02/database/orcl11202/snapcf_orcl11202.f tag=TAG20111214T103545 RECID=15 STAMP=769862155
channel C1: datafile copy complete, elapsed time: 00:00:15
Finished backup at 14-DEC-11

Starting restore at 14-DEC-11

channel DUP: copied control file copy
Finished restore at 14-DEC-11

database mounted

contents of Memory Script:
{
   sql clone 'alter database flashback off';
   set newname for datafile  1 to
 "/u02/database/PRIMDB/system01.dbf";
   set newname for datafile  2 to
 "/u02/database/PRIMDB/sysaux01.dbf";
   set newname for datafile  3 to
 "/u02/database/PRIMDB/undotbs01.dbf";
   set newname for datafile  4 to
 "/u02/database/PRIMDB/users01.dbf";
   set newname for datafile  5 to
 "/u02/database/PRIMDB/example01.dbf";
   set newname for datafile  6 to
 "/u02/database/PRIMDB/ccdata.dbf";
   backup as copy reuse
   datafile  1 auxiliary format
 "/u02/database/PRIMDB/system01.dbf"   datafile
 2 auxiliary format
 "/u02/database/PRIMDB/sysaux01.dbf"   datafile
 3 auxiliary format
 "/u02/database/PRIMDB/undotbs01.dbf"   datafile
 4 auxiliary format
 "/u02/database/PRIMDB/users01.dbf"   datafile
 5 auxiliary format
 "/u02/database/PRIMDB/example01.dbf"   datafile
 6 auxiliary format
 "/u02/database/PRIMDB/ccdata.dbf"   ;
   sql 'alter system archive log current';
}
executing Memory Script

sql statement: alter database flashback off

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

Starting backup at 14-DEC-11
channel C1: starting datafile copy
input datafile file number=00004 name=/u02/database/orcl11202/users01.dbf
output file name=/u02/database/PRIMDB/users01.dbf tag=TAG20111214T103611
channel C1: datafile copy complete, elapsed time: 00:03:35
channel C1: starting datafile copy
input datafile file number=00003 name=/u02/database/orcl11202/undotbs01.dbf
output file name=/u02/database/PRIMDB/undotbs01.dbf tag=TAG20111214T103611
channel C1: datafile copy complete, elapsed time: 00:01:45
channel C1: starting datafile copy
input datafile file number=00006 name=/u02/database/orcl11202/ccdata.dbf
output file name=/u02/database/PRIMDB/ccdata.dbf tag=TAG20111214T103611
channel C1: datafile copy complete, elapsed time: 00:01:15
channel C1: starting datafile copy
input datafile file number=00001 name=/u02/database/orcl11202/system01.dbf
output file name=/u02/database/PRIMDB/system01.dbf tag=TAG20111214T103611
channel C1: datafile copy complete, elapsed time: 00:00:35
channel C1: starting datafile copy
input datafile file number=00002 name=/u02/database/orcl11202/sysaux01.dbf
output file name=/u02/database/PRIMDB/sysaux01.dbf tag=TAG20111214T103611
channel C1: datafile copy complete, elapsed time: 00:00:25
channel C1: starting datafile copy
input datafile file number=00005 name=/u02/database/orcl11202/example01.dbf
output file name=/u02/database/PRIMDB/example01.dbf tag=TAG20111214T103611
channel C1: datafile copy complete, elapsed time: 00:00:15
Finished backup at 14-DEC-11

sql statement: alter system archive log current

contents of Memory Script:
{
   backup as copy reuse
   archivelog like  "/u02/fra/ORCL11202/archivelog/2011_12_14/o1_mf_1_429_7gjzhnxp_.arc" auxiliary format
 "/u02/fra/1_429_769281339.arc"   ;
   catalog clone archivelog  "/u02/fra/1_429_769281339.arc";
   switch clone datafile all;
}
executing Memory Script

Starting backup at 14-DEC-11
channel C1: starting archived log copy
input archived log thread=1 sequence=429 RECID=427 STAMP=769862645
output file name=/u02/fra/1_429_769281339.arc RECID=0 STAMP=0
channel C1: archived log copy complete, elapsed time: 00:00:01
Finished backup at 14-DEC-11

cataloged archived log
archived log file name=/u02/fra/1_429_769281339.arc RECID=427 STAMP=769862647

datafile 1 switched to datafile copy
input datafile copy RECID=15 STAMP=769862648 file name=/u02/database/PRIMDB/system01.dbf
datafile 2 switched to datafile copy
input datafile copy RECID=16 STAMP=769862648 file name=/u02/database/PRIMDB/sysaux01.dbf
datafile 3 switched to datafile copy
input datafile copy RECID=17 STAMP=769862648 file name=/u02/database/PRIMDB/undotbs01.dbf
datafile 4 switched to datafile copy
input datafile copy RECID=18 STAMP=769862648 file name=/u02/database/PRIMDB/users01.dbf
datafile 5 switched to datafile copy
input datafile copy RECID=19 STAMP=769862648 file name=/u02/database/PRIMDB/example01.dbf
datafile 6 switched to datafile copy
input datafile copy RECID=20 STAMP=769862648 file name=/u02/database/PRIMDB/ccdata.dbf

contents of Memory Script:
{
   set until scn  3834830;
   recover
   clone database
    delete archivelog
   ;
}
executing Memory Script

executing command: SET until clause

Starting recover at 14-DEC-11

starting media recovery

archived log for thread 1 with sequence 429 is already on disk as file /u02/fra/1_429_769281339.arc
archived log file name=/u02/fra/1_429_769281339.arc thread=1 sequence=429
media recovery complete, elapsed time: 00:00:00
Finished recover at 14-DEC-11
Oracle instance started

Total System Global Area     284008448 bytes

Fixed Size                     2157624 bytes
Variable Size                243274696 bytes
Database Buffers              33554432 bytes
Redo Buffers                   5021696 bytes

contents of Memory Script:
{
   sql clone "alter system set  db_name =
 ''PRIMDB'' comment=
 ''Reset to original value by RMAN'' scope=spfile";
   sql clone "alter system reset  db_unique_name scope=spfile";
   shutdown clone immediate;
   startup clone nomount;
}
executing Memory Script

sql statement: alter system set  db_name =  ''PRIMDB'' comment= ''Reset to original value by RMAN'' scope=spfile

sql statement: alter system reset  db_unique_name scope=spfile

Oracle instance shut down

connected to auxiliary database (not started)
Oracle instance started

Total System Global Area     284008448 bytes

Fixed Size                     2157624 bytes
Variable Size                243274696 bytes
Database Buffers              33554432 bytes
Redo Buffers                   5021696 bytes
allocated channel: DUP
channel DUP: SID=133 device type=DISK
sql statement: CREATE CONTROLFILE REUSE SET DATABASE "PRIMDB" RESETLOGS ARCHIVELOG
  MAXLOGFILES     16
  MAXLOGMEMBERS      3
  MAXDATAFILES      100
  MAXINSTANCES     8
  MAXLOGHISTORY     1597
 LOGFILE
  GROUP  1 ( '/u02/database/PRIMDB/redo01.log' ) SIZE 50 M  REUSE,
  GROUP  2 ( '/u02/database/PRIMDB/redo02.log' ) SIZE 50 M  REUSE,
  GROUP  3 ( '/u02/database/PRIMDB/redo03.log' ) SIZE 50 M  REUSE
 DATAFILE
  '/u02/database/PRIMDB/system01.dbf'
 CHARACTER SET WE8MSWIN1252

contents of Memory Script:
{
   set newname for tempfile  1 to
 "/u02/database/PRIMDB/temp01.dbf";
   switch clone tempfile all;
   catalog clone datafilecopy  "/u02/database/PRIMDB/sysaux01.dbf",
 "/u02/database/PRIMDB/undotbs01.dbf",
 "/u02/database/PRIMDB/users01.dbf",
 "/u02/database/PRIMDB/example01.dbf",
 "/u02/database/PRIMDB/ccdata.dbf";
   switch clone datafile all;
}
executing Memory Script

executing command: SET NEWNAME

renamed tempfile 1 to /u02/database/PRIMDB/temp01.dbf in control file

cataloged datafile copy
datafile copy file name=/u02/database/PRIMDB/sysaux01.dbf RECID=1 STAMP=769862682
cataloged datafile copy
datafile copy file name=/u02/database/PRIMDB/undotbs01.dbf RECID=2 STAMP=769862682
cataloged datafile copy
datafile copy file name=/u02/database/PRIMDB/users01.dbf RECID=3 STAMP=769862682
cataloged datafile copy
datafile copy file name=/u02/database/PRIMDB/example01.dbf RECID=4 STAMP=769862682
cataloged datafile copy
datafile copy file name=/u02/database/PRIMDB/ccdata.dbf RECID=5 STAMP=769862682

datafile 2 switched to datafile copy
input datafile copy RECID=1 STAMP=769862682 file name=/u02/database/PRIMDB/sysaux01.dbf
datafile 3 switched to datafile copy
input datafile copy RECID=2 STAMP=769862682 file name=/u02/database/PRIMDB/undotbs01.dbf
datafile 4 switched to datafile copy
input datafile copy RECID=3 STAMP=769862682 file name=/u02/database/PRIMDB/users01.dbf
datafile 5 switched to datafile copy
input datafile copy RECID=4 STAMP=769862682 file name=/u02/database/PRIMDB/example01.dbf
datafile 6 switched to datafile copy
input datafile copy RECID=5 STAMP=769862682 file name=/u02/database/PRIMDB/ccdata.dbf
Reenabling controlfile options for auxiliary database
Executing: alter database enable block change tracking using file '/u02/database/PRIMDB/bct.dbf'

contents of Memory Script:
{
   Alter clone database open resetlogs;
}
executing Memory Script

database opened
Executing: alter database flashback on
Finished Duplicate Db at 14-DEC-11
released channel: C1
released channel: DUP</pre>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- google_ad_section_end -->]]></content:encoded>
			<wfw:commentRss>http://www.sysdbaonline.com/2011/12/oracle-11g-active-duplicate-database/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Oracle &#8211; How to improve delete performance</title>
		<link>http://www.sysdbaonline.com/2011/12/oracle-how-to-improve-delete-performance/</link>
		<comments>http://www.sysdbaonline.com/2011/12/oracle-how-to-improve-delete-performance/#comments</comments>
		<pubDate>Tue, 13 Dec 2011 11:44:28 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[11G]]></category>
		<category><![CDATA[Oracle]]></category>
		<category><![CDATA[Oracle DB]]></category>

		<guid isPermaLink="false">http://www.sysdbaonline.com/?p=1182</guid>
		<description><![CDATA[Problem :  I was asked to delete the 1 Million rows from the table and I wanted make sure that it take bare minimum resources and time. Solution : I tried all possible solutions on my test system and here are findings. I had created a test table with 100000 rows with one index on [...]]]></description>
			<content:encoded><![CDATA[<!-- google_ad_section_start --><p><strong>Problem : </strong></p>
<p>I was asked to delete the 1 Million rows from the table and I wanted make sure that it take bare minimum resources and time.</p>
<p><strong>Solution :</strong></p>
<p>I tried all possible solutions on my test system and here are findings.</p>
<p>I had created a test table with 100000 rows with one index on top of it.</p>
<pre class="brush: sql; gutter: false">SQL&gt; select count(*) from custaccounts;

  COUNT(*)
----------
   1000000

SQL&gt; select index_name from user_indexes where table_name ='CUSTACCOUNTS';

INDEX_NAME
------------------------------
CA_U1
CA_PK

SQL&gt; select num_rows from user_indexes where table_name ='CUSTACCOUNTS';

  NUM_ROWS
----------
   1017005
   1013011

Elapsed: 00:00:00.13</pre>
<ul>
<li><strong>DELETE NORMALLY:</strong></li>
</ul>
<pre class="brush: sql; gutter: false">SQL&gt; delete from CUSTACCOUNTS;

1000000 rows deleted.

Elapsed: 00:35:08.93</pre>
<pre class="brush: sql; gutter: false">This operation had generated 17 Archive logs.</pre>
<ul>
<li><strong>DELETE WITH NOLOGGING:</strong></li>
</ul>
<div>Most of the people thinks that if they perform delete with nologging , it will have good performance improvement because nologging will not create any redo.Its not true guys.let me prove my point with demo.</div>
<div>
<pre class="brush: sql; gutter: false">SQL&gt; delete from custaccounts nologging;

1000000 rows deleted.

Elapsed: 00:34:09.29</pre>
<pre class="brush: sql; gutter: false">This operation had generated 16 Archive logs.I even tried the rollback operation as well and it went through fine.</pre>
<ul>
<li><strong>DELETE PARALLEL:</strong></li>
</ul>
<div>Next I thought of doing delete in parallel.</div>
<div>
<pre class="brush: sql; gutter: false">SQL&gt;alter session enable parallel dml;

session altered.

SQL&gt; delete from custaccounts;</pre>
<pre>1000000 rows deleted.

Elapsed: 00:34:05.29</pre>
</div>
</div>
<div>This operation had generated 16 archive logs.</div>
<div>
<ul>
<li><strong>DELETE INDEX and DELETE ROWS:</strong></li>
</ul>
<div>Now I tried with deleting the indexes of the table first and than tried the delete operation.I could see good performance improvement with this method.</div>
</div>
<div>
<pre class="brush: sql; gutter: false">SQL&gt; drop index CA_U1;

Index dropped.

Elapsed: 00:00:00.75

SQL&gt; select index_name from user_indexes where table_name ='CUSTACCOUNTS';

INDEX_NAME
------------------------------
CA_PK

Elapsed: 00:00:00.17

SQL&gt; delete from custaccounts;

1000000 rows deleted.</pre>
<pre class="brush: sql; gutter: false">Elapsed: 00:23:30.71</pre>
<pre class="brush: sql; gutter: false">This operation had generated 12 archive logs.</pre>
<ul>
<li><strong>CONCLUSION:</strong></li>
</ul>
<pre>After performing delete operation with different option, I came to following conclusion.</pre>
<pre></pre>
<pre><strong></p>
<table class="wptable rowstyle-alt" id="wptable-2"  cellspacing="1">
	<thead>
	<tr>
		<th class="sortable" style="width:200px" align="left">Operation</th>
		<th class="sortable" style="width:40px" align="center">Duration</th>
		<th class="sortable" style="width:60px" align="center">Archive logs</th>
		<th class="sortable" style="width:10px" align="center">Recommended</th>
	</tr>
	</thead>
	<tr>
		<td style="width:200px" align="left">DELETE</td>
		<td style="width:40px" align="center">00:35:08.93</td>
		<td style="width:60px" align="center">17</td>
		<td style="width:10px" align="center">No</td>
	</tr>
	<tr class="alt">
		<td style="width:200px" align="left">DELETE NOLOGGING</td>
		<td style="width:40px" align="center">00:34:09.29</td>
		<td style="width:60px" align="center">16</td>
		<td style="width:10px" align="center">No</td>
	</tr>
	<tr>
		<td style="width:200px" align="left">DELETE PARALLEL</td>
		<td style="width:40px" align="center">00:34:08.00</td>
		<td style="width:60px" align="center">16</td>
		<td style="width:10px" align="center">No</td>
	</tr>
	<tr class="alt">
		<td style="width:200px" align="left">DELETE WITH NO INDEX</td>
		<td style="width:40px" align="center">00:23:30.71</td>
		<td style="width:60px" align="center">12</td>
		<td style="width:10px" align="center">Yes</td>
	</tr>
</table><p>
</strong></pre>
<pre></pre>
<pre class="brush: sql; gutter: false"></pre>
</div>
<!-- google_ad_section_end -->]]></content:encoded>
			<wfw:commentRss>http://www.sysdbaonline.com/2011/12/oracle-how-to-improve-delete-performance/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Oracle RAC &#8211; SCAN &#8211; DNS Server Setup &#8211; OpenFiler 2.3</title>
		<link>http://www.sysdbaonline.com/2011/11/dns-server-setup-openfiler-2-3/</link>
		<comments>http://www.sysdbaonline.com/2011/11/dns-server-setup-openfiler-2-3/#comments</comments>
		<pubDate>Sun, 20 Nov 2011 00:16:35 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[RAC]]></category>

		<guid isPermaLink="false">http://www.sysdbaonline.com/?p=1090</guid>
		<description><![CDATA[Problem: I need to setup the 11GR2 RAC (Real Application Cluster) and I know that in 11GR2 Oracle has introduced new Grid infrasturctre  feature called SCAN which requires DNS server in place before you could setup the Grid Infrastructure. So what is SCAN and how to setup the DNS server for SCAN. Solution: Before I [...]]]></description>
			<content:encoded><![CDATA[<!-- google_ad_section_start --><p><strong>Problem:</strong></p>
<p>I need to setup the 11GR2 RAC (Real Application Cluster) and I know that in 11GR2 Oracle has introduced new Grid infrasturctre  feature called SCAN which requires DNS server in place before you could setup the Grid Infrastructure.</p>
<p>So what is SCAN and how to setup the DNS server for SCAN.</p>
<p><strong>Solution:</strong></p>
<p>Before I dive deep into DNS server configuration , let me take a moment to explain what is SCAN and why needs DNS server.I will also explain why /etc/hosts can not be used for SCAN.</p>
<p><strong>What is SCAN ?</strong></p>
<p>SCAN : It stands for Single Client Access Name.Single Client Access Name (SCAN) is a new Oracle Real Application Clusters (RAC) 11g Release 2 feature that provides a single name for clients to access Oracle Databases running in a cluster. The benefit is that the client’s connect information does not need to change if you add or remove nodes in the cluster.</p>
<p>Example:</p>
<pre class="brush: text; gutter: false">Ezconnet sqlplus system/manager@scan:1521/racdb
JDBC connect jdbc:oracle:thin:@scan:1521/racdb</pre>
<p><strong>Why it is very good feature?</strong></p>
<p>In previous Oracle RAC releases you will need to setup the tnsnames.ora in such a way so that it know all the VIP (Virtual IP) address in it so client can connect to Oracle RAC database which are listening on VIP address.</p>
<p>For example,</p>
<pre class="brush: text; gutter: false">racdb10g =
  (DESCRIPTION=
    (LOAD_BALANCE=ON)
    (FAILOVER=ON)
    (ADDRESS=(PROTOCOL=TCP)(HOST=node1)(PORT=1521))
    (ADDRESS=(PROTOCOL=TCP)(HOST=node2)(PORT=1521))
    (CONNECT_DATA=
      (SERVICE_NAME=racdb10g)
      (FAILOVER_MODE=
        (TYPE=SELECT)
        (METHOD=BASIC)
        (RETRIES=10)
        (DELAY=15)
      )
    )
  )</pre>
<p>So if you add a node to existing cluster or remote a node from the existing cluster you will need to modify the tnsnames.ora file on all the client.This can be pain if you have 1000 client computers using the RAC database ,so Oracle has come up with SCAN which solves this problem.</p>
<p>With SCAN &#8211; Your entire cluster will be identified with single common clustered name which you need to use while connecting to cluster so it does not matter whether you add a node or remote a node from cluster.You do not need to modify client&#8217;s tnsnames.ora</p>
<p>For example:</p>
<pre class="brush: text; gutter: false">racdb10g =
  (DESCRIPTION=
    (LOAD_BALANCE=ON)
    (FAILOVER=ON)
    (ADDRESS=(PROTOCOL=TCP)(HOST=scan)(PORT=1521))
    (CONNECT_DATA=
      (SERVICE_NAME=racdb10g)
      (FAILOVER_MODE=
        (TYPE=SELECT)
        (METHOD=BASIC)
        (RETRIES=10)
        (DELAY=15)
      )
    )
  )</pre>
<p>SCAN also provides the connect time load balancing so it forwards the request to least loaded node in the cluster which completely transparent to client.</p>
<p><strong>What happens behind the scene ?</strong></p>
<p>When client wants a connection database unlike the previous releases the client will use SCAN as specified in tnsnames.ora.The DNS server will return three IP addresses for the SCAN and the client will try to connect to each IP address given by DNS server until the connection is not made.</p>
<p>So with 11GR2 the Client will initiate the connection to SCAN listener which will forward the connection request to least loaded the node within the cluster.</p>
<p>The flow will be,</p>
<p>Client Connection Request &#8211;&gt; SCAN listener &#8211;&gt; Node listener (Running on Virtual IP)</p>
<p><strong>Why SCAN needs DNS ?</strong></p>
<p>You must have DNS server setup if you want to use SCAN.The reason is, if you use /etc/hosts file for the SCAN than all the requests for the SCAN will be forwarded to first SCAN node specified in /etc/hosts because /etc/hosts file does not have capability of round robin name resolution but If you use the DNS server than SCAN can take the advantage of DNS&#8217;s round robin name resolution feature.</p>
<p>Enough talk about the SCAN background.Let me show you the DNS server configuration now.</p>
<p>For my test 11.2.0.1 RAC setup , I am using the openfiler as a shared storage.The openfiler is nothing but modified linux only so you have a capability of using it as a DNS server which can be used by the RAC clients.</p>
<p>FYI, SCAN configuration is not supported with /etc/hosts file.its only supported with one SCAN IP Address specified in /etc/hosts file if you have upgrading from previous release.Please note only and only IP Address in /etc/hosts.</p>
<p>Please follow the following steps to setup Open Filer as a DNS server as well.</p>
<ul>
<li>Install Bind DNS Server package on  OpenFiler</li>
</ul>
<pre class="brush: shell; gutter: false">[root@openfiler ~]# conary update bind:runtime
Including extra troves to resolve dependencies:
    bind:config=9.4_ESV_R4_P1-0.1-1 bind:lib=9.4_ESV_R4_P1-0.1-1 info-named:user=1-2-0.1
Applying update job 1 of 2:
    Install info-named(:user)=1-2-0.1
Applying update job 2 of 2:
    Install bind(:config :lib :runtime)=9.4_ESV_R4_P1-0.1-1</pre>
<ul>
<li>DNS Server configuration.</li>
</ul>
<p>/etc/named.conf should look like,</p>
<pre class="brush: text; gutter: false">options {
	directory "/etc";
	pid-file "/var/run/named/named.pid";
};

zone "example.com" {
     type master;
     file "/etc/example.com.hosts";
};

zone "0.168.192.in-addr.arpa" {
     type master;
     file "/etc/192.168.0.rev";
};

zone "10.10.10.in-addr.arpa" {
     type master;
     file "/etc/10.10.10.rev";
};</pre>
<ul>
<li>/etc/example.com.hosts should have following entries,</li>
</ul>
<pre class="brush: text; gutter: false">$ttl 38400
example.com.    IN      SOA     node1. admin.example.com. (
							1316874398
							10800
							3600
							604800
							38400 )
example.com.    IN      NS      openfiler.

openfiler.example.com.  IN      A       192.168.0.45

node1.example.com.      IN      A       192.168.0.110
node2.example.com.      IN      A       192.168.0.120

node1-vip.example.com.  IN      A       192.168.0.111
node2-vip.example.com.  IN      A       192.168.0.121

node1-priv.example.com. IN      A       10.10.10.110
node2-priv.example.com. IN      A       10.10.10.120

scan.example.com.       IN      A       192.168.0.140
scan.example.com.       IN      A       192.168.0.150
scan.example.com.       IN      A       192.168.0.160</pre>
<ul>
<li>/etc/192.168.1.rev should have following entries,</li>
</ul>
<pre class="brush: text; gutter: false">$ttl 38400
0.168.192.in-addr.arpa. IN SOA openfiler. admin.example.com. (
								1316875143
								10800
								3600
								604800
								38400
							     )
0.168.192.in-addr.arpa. IN NS openfiler.

45.0.168.192.in-addr.arpa. 	IN PTR openfiler.

110.0.168.192.in-addr.arpa. 	IN PTR node1.
120.0.168.192.in-addr.arpa. 	IN PTR node2.

111.0.168.192.in-addr.arpa. 	IN PTR node1-vip.
121.0.168.192.in-addr.arpa. 	IN PTR node2-vip.

140.0.168.192.in-addr.arpa. 	IN PTR scan.
150.0.168.192.in-addr.arpa. 	IN PTR scan.
150.0.168.192.in-addr.arpa. 	IN PTR scan.</pre>
<ul>
<li>/etc/10.10.10.rev  should have following entries,</li>
</ul>
<pre class="brush: text; gutter: false">$ttl 38400
10.10.10.in-addr.arpa. IN SOA openfiler. admin.example.com. (
								1316875143
								10800
								3600
								604800
								38400
								)
10.10.10.in-addr.arpa. IN NS openfiler.

110.10.10.10.in-addr.arpa.      IN      PTR     node1-priv.
120.10.10.10.in-addr.arpa.      IN      PTR     node2-priv.</pre>
<ul>
<li>Start the DNS Server.</li>
</ul>
<div>
<pre class="brush: shell; gutter: false">/etc/init.d/named start</pre>
</div>
<ul>
<li>Test the DNS Server.</li>
</ul>
<div>
<div>
<pre class="brush: shell; gutter: false">[oracle@node1] nslookup scan
Server:         192.168.0.110
Address:        192.168.0.45#53
Non-authoritative answer:
Name:   scan.example.com
Address: 192.168.0.140
Name:   scan.example.com
Address: 192.168.0.150
Name:   scan.example.com
Address: 192.168.0.160</pre>
<pre class="brush: shell; gutter: false">Check the log if the name resolution does not work.

/var/log/messages</pre>
</div>
</div>
<!-- google_ad_section_end -->]]></content:encoded>
			<wfw:commentRss>http://www.sysdbaonline.com/2011/11/dns-server-setup-openfiler-2-3/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Powershell &#8211; Script to report any NTP related message from the Eventlog</title>
		<link>http://www.sysdbaonline.com/2011/11/powershell-script-to-report-any-ntp-related-message-from-the-eventlog/</link>
		<comments>http://www.sysdbaonline.com/2011/11/powershell-script-to-report-any-ntp-related-message-from-the-eventlog/#comments</comments>
		<pubDate>Wed, 16 Nov 2011 16:50:52 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Powershell]]></category>

		<guid isPermaLink="false">http://www.sysdbaonline.com/?p=1165</guid>
		<description><![CDATA[Problem : I had setup the NTP server few days back so that my all domain computer can use it as a time source.I had created the group policy that forces all the domain computer to use the NTP server as a time source.Now I wanted to create a monitor which tells me when there is [...]]]></description>
			<content:encoded><![CDATA[<!-- google_ad_section_start --><p><strong>Problem :</strong></p>
<p>I had setup the NTP server few days back so that my all domain computer can use it as a time source.I had created the group policy that forces all the domain computer to use the NTP server as a time source.Now I wanted to create a monitor which tells me when there is a NTP related problem reported into the eventlog.As always I had decided to go with Powershell to read the Eventlog remotely.</p>
<p><strong>Solution :</strong></p>
<p>I used the Powershell&#8217;s Get-wmiobject command to read the Eventlog of all the machine remotely.I used the select-string argument so narrow down the search to only NTP related messages.</p>
<p>Here is powershell script which I had created to create my monitor.</p>
<pre class="brush: powershell; gutter: false">$BeginDate=[System.Management.ManagementDateTimeConverter]::ToDMTFDateTime((get-date).AddDays(-1))
$servers = 'Node1', 'Node2', 'Node3'
ForEach ($server in $servers) {
Get-WmiObject -computer $servers -class Win32_NTLogEvent -filter "(logfile='system') and (TimeGenerated &gt;'$BeginDate')" | where {$_.message | select-string -pattern "The time"} | Select Computername, timegenerated, Message
}</pre>
<pre class="brush: powershell; gutter: false">The output was as following,</pre>
<pre class="brush: text; gutter: false">Computername                         timegenerated                           Message
------------                         -------------                           -------
Node1.example.co.uk                  20111114183223.468053-000               The time service is now synchronizin...
Node2.example.co.uk                  20111114182604.593400-000               Time Provider NtpClient: This machin...</pre>
<pre class="brush: text; gutter: false">You can use this script to search anything from the eventlog.You just need to change the select-string accordingly.</pre>
<pre class="brush: text; gutter: false">Update:</pre>
<pre class="brush: text; gutter: false">The another approach can be to use get-eventlog as following,</pre>
<pre class="brush: powershell; gutter: false">$servers = 'Node1', 'Node2', 'Node3'
get-eventlog -LogName System -Message “The time*” -after (get-date).AddDays(-7) -comp $servers |
Select @{Name=”Computername”;Expression={$_.MachineName}},TimeGenerated,Message</pre>
<pre class="brush: powershell; gutter: false">Thanks to Jeffery Hicks to let me know about the another method.</pre>
<!-- google_ad_section_end -->]]></content:encoded>
			<wfw:commentRss>http://www.sysdbaonline.com/2011/11/powershell-script-to-report-any-ntp-related-message-from-the-eventlog/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Powershell &#8211; Script to read Windows time remotely</title>
		<link>http://www.sysdbaonline.com/2011/11/powershell-script-to-read-windows-time-remotely/</link>
		<comments>http://www.sysdbaonline.com/2011/11/powershell-script-to-read-windows-time-remotely/#comments</comments>
		<pubDate>Tue, 15 Nov 2011 10:39:19 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Powershell]]></category>

		<guid isPermaLink="false">http://www.sysdbaonline.com/?p=1122</guid>
		<description><![CDATA[I was looking for an option which can allow me to read windows (Domain Client) machines time remotely. I was in process of setting up the NTP group policy for my Windows domain controller and it would have been a big pain when it comes checking/comparing windows time by login into each and every domain [...]]]></description>
			<content:encoded><![CDATA[<!-- google_ad_section_start --><p>I was looking for an option which can allow me to read windows (Domain Client) machines time remotely.</p>
<p>I was in process of setting up the NTP group policy for my Windows domain controller and it would have been a big pain when it comes checking/comparing windows time by login into each and every domain client computers.I have more than 500 domain client computers in my domain controller so you can imagine how much time it would have taken to login in each machine and check whether the time is in sync with NTP server.</p>
<p>I thought to script the operation which reads the windows domain client&#8217;s time remotely so I can compare and check whether all the computers are having same time or not.I had decided to script the operation with Powershell and it did the exact job which I was looking for.</p>
<pre class="brush: powershell; gutter: false">$servers = 'Node1', 'Node2', 'Node3'

ForEach ($server in $servers) {
    $time = ([WMI]'').ConvertToDateTime((gwmi win32_operatingsystem -computername $server).LocalDateTime)
    $server + '  ' + $time
}</pre>
<pre class="brush: powershell; gutter: false">The output was as following,</pre>
<pre class="brush: text; gutter: false">Node1  11/15/2011 09:54:07
Node2  11/15/2011 09:54:07
Node3  11/15/2011 09:54:07</pre>
<!-- google_ad_section_end -->]]></content:encoded>
			<wfw:commentRss>http://www.sysdbaonline.com/2011/11/powershell-script-to-read-windows-time-remotely/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>SQL Server 2008 R2&#8211;Setup Database Mirroring using CLI</title>
		<link>http://www.sysdbaonline.com/2011/11/sql-server-2008-r2setup-database-mirroring-using-cli/</link>
		<comments>http://www.sysdbaonline.com/2011/11/sql-server-2008-r2setup-database-mirroring-using-cli/#comments</comments>
		<pubDate>Mon, 14 Nov 2011 09:59:00 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[MS SQL]]></category>

		<guid isPermaLink="false">http://www.sysdbaonline.com/?p=1107</guid>
		<description><![CDATA[&#160; Please follow the following steps to setup the MS SQL Database Mirroring.The MS SQL database mirroring is a very good low cost high availability solution.The MS SQL database Mirroring can be configured using the SSMS (SQL Server Management Studio) but If you really want to know what&#8217;s happening behind the scene then you need [...]]]></description>
			<content:encoded><![CDATA[<!-- google_ad_section_start --><p>&nbsp;</p>
<p>Please follow the following steps to setup the MS SQL Database Mirroring.The MS SQL database mirroring is a very good low cost high availability solution.The MS SQL database Mirroring can be configured using the SSMS (SQL Server Management Studio) but If you really want to know what&#8217;s happening behind the scene then you need to setup the mirroring using the command line.</p>
<p>You need to have at least 3 different servers or SQL Server instance to setup the database mirroring.I would recommend to have different SQL Server instances running on the different machines for the production environment.</p>
<p>For this example,</p>
<table width="521" border="2" cellspacing="0" cellpadding="2">
<tbody>
<tr>
<td valign="top" width="127">Primary Server</td>
<td valign="top" width="132">Mirror Server</td>
<td valign="top" width="126">Witness Server</td>
<td valign="top" width="132">Database Name</td>
</tr>
<tr>
<td valign="top" width="127">Node1\P01</td>
<td valign="top" width="132">Node2\S01</td>
<td valign="top" width="126">Node3\W01</td>
<td valign="top" width="132">TestDB</td>
</tr>
</tbody>
</table>
<h2></h2>
<p>Please note that you need to Primary and Secondary instances running under Enterprise edition or Standard Edition but witness server can run on the Express edition.</p>
<p>The witness server will be responsible to monitoring the primary and secondary instance and will initiate the automatic failover if witness server and secondary server can not see the primary server.</p>
<p><span style="font-size: medium;">Prerequisites:</span></p>
<ul>
<li>Make sure that Database to be mirrored is in running under FULL recovery model.</li>
</ul>
<pre class="brush: sql; gutter: false">SELECT name AS [Database Name],
recovery_model_desc AS [Recovery Model]
FROM sys.databases
GO</pre>
<p><a href="http://www.sysdbaonline.com/wp-content/uploads/2011/11/Recovery_model.jpg"><img style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border: 0px;" title="Recovery_model" src="http://www.sysdbaonline.com/wp-content/uploads/2011/11/Recovery_model_thumb.jpg" alt="Recovery_model" width="309" height="99" border="0" /></a></p>
<ul>
<li>Make sure that all the SQL Server instances are configured to allow TCP/IP connections.</li>
</ul>
<p>You can check from the SQL Server configuration Manager &#8212;&gt; SQL Server Network Configuration &#8212;&gt; Protocols for TestDB</p>
<p><a href="http://www.sysdbaonline.com/wp-content/uploads/2011/11/TCP-IP.jpg"><img style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border: 0px;" title="TCP-IP" src="http://www.sysdbaonline.com/wp-content/uploads/2011/11/TCP-IP_thumb.jpg" alt="TCP-IP" width="308" height="105" border="0" /></a></p>
<ul>
<li>Make sure that all the SQL Server instances are running under the same Domain user account.If the server instances are running under different domain user accounts, each requires a login in the <strong>master</strong> database of the others.</li>
<li>Make sure that both Primary and Secondary instances are running same edition of SQL server software.</li>
</ul>
<p><span style="font-size: medium;">Configuration Steps:</span></p>
<ul>
<li>Create the Mirroring Endpoint on all the Servers.</li>
</ul>
<pre class="brush: sql; gutter: false">-- Create Database Mirroring Endpoint on Principal Server
CREATE ENDPOINT [Mirroring]
AUTHORIZATION [EXAMPLE\Administrator]
STATE=STARTED
AS TCP (LISTENER_PORT = 7028, LISTENER_IP = ALL)
FOR DATA_MIRRORING (ROLE = PARTNER, AUTHENTICATION = WINDOWS NEGOTIATE,
ENCRYPTION = REQUIRED ALGORITHM RC4);
GO</pre>
<pre class="brush: sql; gutter: false">-- Create Database Mirroring Endpoint on Mirror Server
CREATE ENDPOINT [Mirroring]
AUTHORIZATION [EXAMPLE\Administrator]
STATE=STARTED
AS TCP (LISTENER_PORT = 7028, LISTENER_IP = ALL)
FOR DATA_MIRRORING (ROLE = PARTNER, AUTHENTICATION = WINDOWS NEGOTIATE,
ENCRYPTION = REQUIRED ALGORITHM RC4);
GO</pre>
<pre class="brush: sql; gutter: false">-- Create Database Mirroring Endpoint on the Witness Server
CREATE ENDPOINT [Mirroring]
AUTHORIZATION [EXAMPLE\Administrator]
STATE=STARTED
AS TCP (LISTENER_PORT = 7028, LISTENER_IP = ALL)
FOR DATA_MIRRORING (ROLE = WITNESS, AUTHENTICATION = WINDOWS NEGOTIATE,
ENCRYPTION = REQUIRED ALGORITHM RC4)
GO</pre>
<pre class="brush: sql; gutter: false">-- Verify the Database Mirroring Endpoint Status
SELECT name, protocol_desc, state_desc FROM sys.database_mirroring_endpoints
GO</pre>
<p><a href="http://www.sysdbaonline.com/wp-content/uploads/2011/11/Endpoint_state.jpg"><img style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border: 0px;" title="Endpoint_state" src="http://www.sysdbaonline.com/wp-content/uploads/2011/11/Endpoint_state_thumb.jpg" alt="Endpoint_state" width="322" height="102" border="0" /></a></p>
<ul>
<li>Grant Privileges on the End Points. ( This steps is not necessary if you have created the Endpoints under the Domain admin account )</li>
</ul>
<pre class="brush: sql; gutter: false">-- Execute it on Principal Server
-- Grant Connect to Permission for the DB Engine Accounts (Of Mirror and Witness Server)
-- on the Database Mirroring Endpoint (On Principal Server)
GRANT CONNECT ON ENDPOINT::Mirroring TO [EXAMPLE\Administrator];
GO

-- Execute it on Mirror Server
-- Grant Connect to Permission for the DB Engine Accounts (Of Principal and Witness Server)
-- on the Database Mirroring Endpoint (On Mirror Server)
GRANT CONNECT ON ENDPOINT::Mirroring TO [EXAMPLE\Administrator];
GO

-- Execute it on Witness Server
-- Grant Connect to Permission for the DB Engine Accounts (Of Principal and Mirror Server)
-- on the Database Mirroring Endpoint (On Witness Server)
GRANT CONNECT ON ENDPOINT::Mirroring TO [EXAMPLE\Administrator];
GO</pre>
<ul>
<li>Backup the Database to be mirrored.</li>
</ul>
<pre class="brush: sql; gutter: false">-- Backup the TestDB database on the Principal Server
USE [master]
GO
BACKUP DATABASE [TestDB]
TO DISK = '\\Node2\c$\SQL_DATABASE_BACKUPS\TestDB.bak';
GO
BACKUP LOG [TestDB]
TO DISK = '\\Node2\c$\SQL_DATABASE_BACKUPS\TestDB_Log.trn';
GO</pre>
<ul>
<li>
<div align="left">Restore the TestDB database on the Mirrored instance using NORECOVERY option.</div>
</li>
</ul>
<pre class="brush: sql; gutter: false">-- Restoring the database TestDB from the backup file
USE [master]
GO
RESTORE DATABASE [TestDB]
FROM DISK = 'c:\SQL_DATABASE_BACKUPS\TestDB.bak'
WITH MOVE 'TestDB' TO 'C:\Program Files\Microsoft SQL Server\MSSQL10_50.T02\MSSQL\DATA\TestDB.mdf',
MOVE 'TestDB_log' TO 'C:\Program Files\Microsoft SQL Server\MSSQL10_50.T02\MSSQL\DATA\TestDB.lDF',
NORECOVERY, FILE = 1;
GO
RESTORE LOG [TestDB]
FROM DISK = 'c:\SQL_DATABASE_BACKUPS\TestDB_Log.trn' WITH NORECOVERY;
GO</pre>
<ul>
<li>Setup the Mirroring sessions.</li>
</ul>
<pre class="brush: sql; gutter: false">-- Adding the database to Database Mirroring Session (Execute it on Mirror Server)
USE [master]
ALTER DATABASE [TestDB]
SET PARTNER = 'TCP://Node1.EXAMPLE.COM:7028';
GO
-- Adding the database to Database Mirroring Session (Execute it on Principal Server)
USE [master]
ALTER DATABASE [TestDB]
SET PARTNER = 'TCP://Node2.EXAMPLE.COM:7028';
GO</pre>
<pre class="brush: sql; gutter: false">-- Adding the database to Witness Session (Execute it on Principal Server)

ALTER DATABASE [TestDB]
SET WITNESS = 'TCP://Node3.EXAMPLE.COM:7028';
GO

USE [master]
SELECT * FROM sys.database_mirroring_witnesses;
GO</pre>
<!-- google_ad_section_end -->]]></content:encoded>
			<wfw:commentRss>http://www.sysdbaonline.com/2011/11/sql-server-2008-r2setup-database-mirroring-using-cli/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Powershell Script to read last 5 errors from the eventlog</title>
		<link>http://www.sysdbaonline.com/2011/10/powershell-script-to-read-last-5-errors-from-the-eventlog/</link>
		<comments>http://www.sysdbaonline.com/2011/10/powershell-script-to-read-last-5-errors-from-the-eventlog/#comments</comments>
		<pubDate>Fri, 21 Oct 2011 10:12:20 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Powershell]]></category>

		<guid isPermaLink="false">http://www.sysdbaonline.com/?p=1094</guid>
		<description><![CDATA[Here is the powershell script which can read the eventlog on local or remote machine and returns last 5 errors reported in the Applications and System category. &#160; $ArrComputers = "Computer1","Computer2" foreach ($Computer in $ArrComputers) { write-host "" write-host "====================================" write-host "Computer: $Computer" write-host "====================================" write-host "------------------------------------------" write-host "Last 5 Errors in the Application Category" [...]]]></description>
			<content:encoded><![CDATA[<!-- google_ad_section_start --><p>Here is the powershell script which can read the eventlog on local or remote machine and returns last 5 errors reported in the Applications and System category.</p>
<p>&nbsp;</p>
<pre class="brush: powershell; gutter: false">$ArrComputers = "Computer1","Computer2"
foreach ($Computer in $ArrComputers)
{
write-host ""
write-host "===================================="
write-host "Computer: $Computer"
write-host "===================================="
write-host "------------------------------------------"
write-host "Last 5 Errors in the Application Category"
write-host "------------------------------------------"

$ColItems = Get-WmiObject -class Win32_NTLogEvent -filter "(logfile='Application') AND (type='Error')" -Computer $Computer | Select *
$ColItems[0..47] | Select -last 5 | Format-List EventCode,Type,TimeGenerated,Message

write-host "------------------------------------------"
write-host "Last 5 Errors in the System Category"
write-host "------------------------------------------"

$ColItems1 = Get-WmiObject -class Win32_NTLogEvent -filter "(logfile='System') AND (type='Error')" -Computer $Computer | Select *
$ColItems1[0..47] | Select -last 5 | Format-List EventCode,Type,TimeGenerated,Message
}</pre>
<!-- google_ad_section_end -->]]></content:encoded>
			<wfw:commentRss>http://www.sysdbaonline.com/2011/10/powershell-script-to-read-last-5-errors-from-the-eventlog/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

