<?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>Nikolay Manchev</title>
	<atom:link href="http://manchev.org/feed/" rel="self" type="application/rss+xml" />
	<link>http://manchev.org</link>
	<description>Personal website of an Oracle ACE</description>
	<lastBuildDate>Wed, 21 Mar 2012 08:25:21 +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>HOWTO on Oracle Restart</title>
		<link>http://manchev.org/2012/03/howto-on-oracle-restart/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=howto-on-oracle-restart</link>
		<comments>http://manchev.org/2012/03/howto-on-oracle-restart/#comments</comments>
		<pubDate>Tue, 20 Mar 2012 07:13:53 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[News]]></category>
		<category><![CDATA[linkedin]]></category>

		<guid isPermaLink="false">http://manchev.org/?p=712</guid>
		<description><![CDATA[A wrote a quick tutorial on using Oracle Restart for 11gR2 databases. The full text is available here.]]></description>
			<content:encoded><![CDATA[<p>A wrote a quick tutorial on using Oracle Restart for 11gR2 databases. The full text is available <a href="http://manchev.org/2012/03/keeping-a-single-instance-database-up-with-oracle-restart/">here</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://manchev.org/2012/03/howto-on-oracle-restart/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Keeping a single-instance database up with Oracle Restart</title>
		<link>http://manchev.org/2012/03/keeping-a-single-instance-database-up-with-oracle-restart/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=keeping-a-single-instance-database-up-with-oracle-restart</link>
		<comments>http://manchev.org/2012/03/keeping-a-single-instance-database-up-with-oracle-restart/#comments</comments>
		<pubDate>Tue, 20 Mar 2012 07:12:01 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Database 11g]]></category>
		<category><![CDATA[Grid Infrastructure]]></category>
		<category><![CDATA[Oracle Linux]]></category>
		<category><![CDATA[11g]]></category>
		<category><![CDATA[crsctl]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[grid]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[srvctl]]></category>

		<guid isPermaLink="false">http://manchev.org/?p=692</guid>
		<description><![CDATA[Until 11gR2 we had to rely on custom scripts for starting our single-instance database automatically after system restarts. Most of the time we had to use the /etc/oratab file and the dbstart script. There were some concerns with this approach. &#8230;<p class="read-more"><a href="http://manchev.org/2012/03/keeping-a-single-instance-database-up-with-oracle-restart/">Read more &#187;</a></p>]]></description>
			<content:encoded><![CDATA[<p>Until 11gR2 we had to rely on custom scripts for starting our single-instance database automatically after system restarts. Most of the time we had to use the <em>/etc/oratab</em> file and the <em>dbstart</em> script. There were some concerns with this approach. The early versions of <em>dbstart</em> couldn't start listeners and even now there are severe limitations when it comes to multiple Oracle homes and multiple listeners. We face even greater challenges when we have to deal with ASM dependent databases. Although the script now supports starting databases that rely on ASM (via the "W" flag) this only works for an "ASM server that is auto-started by CRS". In other words <em>dbstart</em> can not start the ASM instance itself.</p>
<p>To overcome these difficulties and improve the availability of our single-instance databases Oracle introduced Oracle Restart. This feature appeared with 11.2.0.1 and can be used to start any database, ASM instance, Net listener and more. On top of this Oracle Restart keeps an eye on all components that it started. Should any of the components fail, Oracle Restart tries to restart it and bring it back to life.</p>
<p>Oracle Restart runs out of the Grid infrastructure home. When you install Oracle Grid Infrastructure for a standalone server and then install and create your database, the database will automatically be added to the Oracle Restart configuration. </p>
<p><br/><br />
<strong>Configuring Oracle Restart for existing database</strong></p>
<p>Adding Oracle Restart to an already installed database requires a little bit more effort. You should start by installing Oracle Grid Infrastructure. In this tutorial I will add Oracle Restart to an existing 11gR2 database. The host is running Oracle Linux 5 and the database is installed in <em>/u01/app/oracle/product/11.2.0/db_orcl</em>.</p>
<p>You shouldn't forget that installing Oracle Grid Infrastructure (even for a standalone installation) requires us to provide space on Oracle ASM for clusterware files. </p>
<p><a href="http://manchev.org/wp-content/uploads/2012/03/oracle_restart.png"><img src="http://manchev.org/wp-content/uploads/2012/03/oracle_restart.png" alt="Setting Up Grid Infrastructure Screen" title="Grid Infrastructure for Standalone Server" width="800" height="600" class="aligncenter size-full wp-image-691" /></a></p>
<p>When installing Oracle Grid Infrastructure select the "Configure Oracle Grid Infrastructure for a Standalone Server" option. During the installation process you will be asked to run the <em>root.sh</em> script. It will put stuff like the <em>oraenv</em> script in place, perform some root actions related to network and most important - it will make the initial configuration of Oracle Clusterware.</p>
<pre>[root@el5 ~]# <strong>/u01/app/oracle/product/11.2.0/grid/root.sh</strong>
Performing root user operation for Oracle 11g 

The following environment variables are set as:
    ORACLE_OWNER= oracle
    ORACLE_HOME=  /u01/app/oracle/product/11.2.0/grid

Enter the full pathname of the local bin directory: [/usr/local/bin]:
The contents of "dbhome" have not changed. No need to overwrite.
The file "oraenv" already exists in /usr/local/bin.  Overwrite it? (y/n)
[n]: <strong>y</strong>
   Copying oraenv to /usr/local/bin ...
The file "coraenv" already exists in /usr/local/bin.  Overwrite it? (y/n)
[n]: <strong>y</strong>
   Copying coraenv to /usr/local/bin ...

Entries will be added to the /etc/oratab file as needed by
Database Configuration Assistant when a database is created
Finished running generic part of root script.
Now product-specific root actions will be performed.
Using configuration parameter file: /u01/app/oracle/product/11.2.0/grid/crs/install/crsconfig_params
Creating trace directory
LOCAL ADD MODE
Creating OCR keys for user 'oracle', privgrp 'oinstall'..
Operation successful.
LOCAL ONLY MODE
Successfully accumulated necessary OCR keys.
Creating OCR keys for user 'root', privgrp 'root'..
Operation successful.
CRS-4664: Node el5 successfully pinned.
Adding Clusterware entries to inittab

el5     2012/02/18 06:56:51     /u01/app/oracle/product/11.2.0/grid/cdata/el5/backup_20120218_065651.olr
Successfully configured Oracle Grid Infrastructure for a Standalone Server
[root@el5 ~]# </pre>
<p>If you want to confirm that Oracle Restart is running, go to the <em>bin</em> directory inside the Grid installation and use the <em>crsctl</em> utility. The <em>check has</em> command will display the current Oracle Restart status (in case you wonder, <em>has</em> stands for High Availability Services).</p>
<pre>[oracle@el5 bin]$ <strong>./crsctl check has</strong>
CRS-4638: Oracle High Availability Services is online
[oracle@el5 bin]$ </pre>
<p>If you want to confirm that Oracle Restart will start automatically with the next reboot, use the <em>config has</em> command.</p>
<pre>[oracle@el5 bin]$ <strong>./crsctl config has</strong>
CRS-4622: Oracle High Availability Services autostart is enabled.
[oracle@el5 bin]$</pre>
<p>The following table summarizes the <em>crsctl</em> commands relevant to Oracle Restart.</p>
<table>
<tr>
<th>Command</th>
<th>Action</th>
</tr>
<tr>
<td>crsctl check has</td>
<td>Displays the Oracle Restart status</td>
</tr>
<tr>
<td>crsctl config has</td>
<td>Displays the Oracle Restart configuration </td>
</tr>
<tr>
<td>crsctl enable has</td>
<td>Enables automatic restart of Oracle Restart</td>
</tr>
<tr>
<td>crsctl disable has</td>
<td>Disables automatic restart of Oracle Restart</td>
</tr>
<tr>
<td>crsctl start has</td>
<td>Starts Oracle Restart </td>
</tr>
<tr>
<td>crsctl stop has [-f]</td>
<td>Stops Oracle Restart </td>
</tr>
</table>
<p><br/><br />
<strong>Registering a database with Oracle Restart</strong></p>
<p>When performing a new database installation and Oracle Grid Infrastructure is already in place, there is no need for manual components registration. There are however three cases where you have to manually add the database and listener to Oracle Restart:</p>
<ul>
<li>when installing the Grid Infrastructure after the Oracle Database (our case)</li>
<li>when creating databases outside DBCA (for example - by running CREATE DATABASE)</li>
<li>when creating database services outside SRVCTL (by executing DBMS_SERVICE.CREATE_SERVICE)</li>
</ul>
<p>To start, stop and configure components with Oracle Restart we use the <em>srvctl</em> command. There is something very important that you should note - there is more than one <em>srvctl</em> executable. Which one to use depends on the component that you want to deal with. The next table summarizes the different options.</p>
<table>
<tr>
<th>Component</th>
<th>Location of <em>srvctl</em></th>
<th>OS User</th>
</tr>
<tr>
<td>Database <br/>Database service</td>
<td>Database home</td>
<td>Database home owner</td>
</tr>
<tr>
<td>ASM Instance <br/>Diskgroup <br/>ONS</td>
<td>Grid Infrastructure home</td>
<td>Grid Infrastructure home owner</td>
</tr>
<tr>
<td>Listener</td>
<td>Home that was used for starting the listener</td>
<td>Owner of the home used to start the listener</td>
</tr>
</table>
<p>The OS User column points out which user you should use when changing the component's configuration. If you simply want to start or stop the component via Oracle Restart than any user who can run <em>srvctl</em> would do.</p>
<p>Let's start with adding the database. In my installation the user who owns the database is called <em>oracle</em>. I will call <em>srvctl</em> with the <em>add database</em> command in order to register my existing database with Oracle Restart.</p>
<pre>[oracle@el5 ~]$ <strong>cd /u01/app/oracle/product/11.2.0/db_orcl/bin/</strong>
[oracle@el5 bin]$ <strong>./srvctl add database -d orcl -o /u01/app/oracle/product/11.2.0/db_orcl</strong>
[oracle@el5 bin]$ </pre>
<p>If you want to confirm that the database was registered you can call <em>srvctl</em> with the <em>config</em> option. This will show a list of components that are configured with Oracle Restart.</p>
<pre>[oracle@el5 bin]$ <strong>./srvctl config</strong>
orcl
[oracle@el5 bin]$</pre>
<p>Providing a database name to the config command displays more details about the configuration of this specific database.</p>
<pre>[oracle@el5 bin]$ <strong>./srvctl config database -d orcl</strong>
Database unique name: orcl
Database name:
Oracle home: /u01/app/oracle/product/11.2.0/db_orcl
Oracle user: oracle
Spfile:
Domain:
Start options: open
Stop options: immediate
Database role: PRIMARY
Management policy: AUTOMATIC
Disk Groups:
Services:
[oracle@el5 bin]$ </pre>
<p><br/><br />
<strong>Testing if Oracle Restart actually works</strong></p>
<p>For testing if Oracle Restart works correctly we could restart the host and see if the database comes up automatically, but there is a quicker and more interesting way to do the test. We said in the beginning of this article that Oracle Restart is not only responsible for starting and stopping the database, but it also constantly monitors the registered components for a failure and restarts them if necessary. To demonstrate this I will kill on of the background database processes (Oracle Recovery Process - RECO) and see if Oracle Restart reacts as expected.</p>
<p>Let's start by finding the process id.</p>
<pre>[root@el5 ~]# <strong>ps U oracle |grep reco</strong>
oracle    6710  0.0  0.9 790876 19968 ?        Ss   07:21   0:00 ora_reco_orcl
[root@el5 ~]#</pre>
<p>In my case the <em>ora_reco_orcl</em> process has the id of 6710. </p>
<pre>[root@el5 ~]# <strong>kill -9 6710</strong>
[root@el5 ~]# ps U oracle |grep reco
[root@el5 ~]#</pre>
<p>You can see that the process is no longer available. If everything is configured correctly, the process should quickly come back (took around 8 seconds on my test installation). Calling <em>ps</em> again shows:</p>
<pre>[root@el5 ~]# <strong>ps U oracle |grep reco</strong>
10771 ?        Ss     0:00 ora_reco_orcl
[root@el5 ~]#</pre>
<p><br/><br />
<strong>Adding a listener to Oracle Restart</strong></p>
<p>When Oracle Grid Infrastructure is installed it configures a default listener on port 1521. The ASM+ instance registers with this listener and if there is no static registration configured for the database it will register with this listener as well. </p>
<p>If you want to configure another listener you have to edit the <em>$ORACLE_HOME/networ/listener.ora</em> and add a record for the new listener there. Let's say I want to configure another listener on port 1522. I  have to add the following lines to my <em>listener.ora</em> file:</p>
<pre>LISTENER_ORCL =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = TCP)(HOST = el5)(PORT = 1522))
    )
  )</pre>
<p>My next step is to add the listener to Oracle Restart via <em>srvctl</em>.</p>
<pre>[oracle@el5 bin]$ <strong>./srvctl add listener -l LISTENER_ORCL -o /u01/app/oracle/product/11.2.0/db_orcl -p "TCP:1522/IPC:ORCL" </strong>
[oracle@el5 bin]$ </pre>
<p>After that I can configure a static database registration with the newly created listener. First I need a record about the listener in <em>tnsnames.ora</em>.</p>
<pre>LISTENER_ORCL =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = el5)(PORT = 1522))
  )</pre>
<p>Then I have to change the LOCAL_LISTENER parameter of the database, setting its value to the name of my new listener (LISTENER_ORCL).</p>
<pre>[oracle@el5 bin]$ <strong>sqlplus / as sysdba</strong>

SQL*Plus: Release 11.2.0.1.0 Production on Tue Feb 21 07:03:35 2012

Copyright (c) 1982, 2009, Oracle.  All rights reserved.

Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL> <strong>alter system set LOCAL_LISTENER="LISTENER_ORCL" scope=spfile;</strong>

System altered.

SQL></pre>
<p>I have to restart the database for the changes to take effect. I will also start LISTENER_ORCL.</p>
<pre>[oracle@el5 bin]$ <strong>./srvctl stop database -d orcl</strong>
[oracle@el5 bin]$ <strong>./srvctl start listener -l LISTENER_ORCL</strong>
[oracle@el5 bin]$ <strong>./srvctl start database -d orcl</strong>
[oracle@el5 bin]$ </pre>
<p>Running lsnrctl shows that LISTENER_ORCL runs on port 1522 and the <em>orcl</em> instance is correctly registered with it.</p>
<pre>[oracle@el5 bin]$ <strong>./lsnrctl status LISTENER_ORCL</strong>

LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 21-FEB-2012 07:21:42

Copyright (c) 1991, 2009, Oracle.  All rights reserved.

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=el5)(PORT=1522)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER_ORCL
Version                   TNSLSNR for Linux: Version 11.2.0.1.0 - Production
Start Date                21-FEB-2012 07:21:22
Uptime                    0 days 0 hr. 0 min. 19 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /u01/app/oracle/product/11.2.0/db_orcl/network/admin/listener.ora
Listener Log File         /u01/app/oracle/product/11.2.0/db_orcl/log/diag/tnslsnr/el5/listener_orcl/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=el5)(PORT=1522)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=ORCL)))
Services Summary...
Service "orcl" has 1 instance(s).
  Instance "orcl", status READY, has 1 handler(s) for this service...
Service "orclXDB" has 1 instance(s).
  Instance "orcl", status READY, has 1 handler(s) for this service...
The command completed successfully
[oracle@el5 bin]$ </pre>
<p><br/><br />
<strong>Starting and stopping components via srvctl</strong></p>
<p>Starting and stopping components is done via the <strong>srvctl</strong> command. Although you can still start different components in the conventional way (<em>lsnrctl</em> for listeners, SQL*Plus for databases etc.), using <em>srvctl</em> is the recommended approach. There are two important reasons for this. First, Oracle Restart will not monitor any components that were not started with <em>srvctl</em>. Second, if you start a component via <em>srvctl</em>, Oracle Restart will automatically start any components on which the specified component depends. </p>
<p>The syntax for starting and stopping components is as follows.</p>
<pre>srvctl [start|stop] [asm|database|diskgroup|home|listener|ons|service] options</pre>
<p>Starting the orcl database via srvctl looks like this.</p>
<pre>srvctl start database -d orcl</pre>
<p>You can pass various options with the <em>-o</em> switch. For example, starting the database in MOUNT mode is done like this:</p>
<pre>srvctl start database -d orcl -o mount</pre>
<p>Starting an ASM instance is similar. </p>
<pre>srvctl start asm</pre>
<p>Or if you want it in NOMOUNT mode:</p>
<pre>srvctl start asm -o nomount</pre>
<p>For stopping components we use the stop command. Here are two examples.</p>
<pre>srvctl stop database -d orcl -o immediate

srvctl stop asm -o abort -f</pre>
<p>The <em>-f</em> option enables <em>srvctl</em> to stop (unmount) the diskgroups before stopping ASM.</p>
<p>You can also start and stop all components managed by Oracle Restart in a given Oracle home.</p>
<pre>srvctl stop home -o oracle_home -s state_file [-t stop_options] [-f]</pre>
<p>Here is an example of stopping everything in <em>/u01/app/oracle/product/11.2.0/db_orcl</em></p>
<pre>[oracle@el5 ~]$ <strong>srvctl stop home -o /u01/app/oracle/product/11.2.0/db_orcl -s /home/oracle/orcl_state</strong>
[oracle@el5 ~]$ </pre>
<p>The state file (<em>orcl_state</em>) is created by <em>srvctl</em>. It contains a list of the components stopped by <em>srvctl</em> and is used for identifying which components should be started when calling <em>srvctl start home</em>.</p>
<pre>[oracle@el5 ~]$ <strong>srvctl start home -o /u01/app/oracle/product/11.2.0/db_orcl -s /home/oracle/orcl_state</strong>
[oracle@el5 ~]$ </pre>
<p>For a complete description of all options for <em>srvctl</em> you should check the <a href="http://docs.oracle.com/cd/E11882_01/server.112/e25494/restart005.htm#i1001971">SRVCTL Command Reference for Oracle Restart</a>.</p>
<p><br/><br />
<strong>Environment variables</strong></p>
<p>If you have to set some environment variables (like ORACLE_SID, ORACLE_HOME etc.) before starting your database, you should know that Oracle Restart can automatically perform this task for you. In fact it can store different sets of variables for any listener, database or ASM instance.</p>
<p>Setting and unsetting variables is done via <em>srvctl</em>, as it is part of the component's configuration. Using <em>srvctl getenv database</em> lists all variables that are currently configured for the database.</p>
<pre>[oracle@el5 ~]$ <strong>srvctl getenv database -d orcl</strong>
orcl:
[oracle@el5 ~]$ </pre>
<p>Adding new variables is done with the <em>setenv</em> command. Let's add ORACLE_SID and ORACLE_HOME to the configuration of <em>orcl</em>.</p>
<pre>[oracle@el5 ~]$ <strong>srvctl setenv database -d orcl -t "ORACLE_SID=orcl,ORACLE_HOME=/u01/app/oracle/product/11.2.0/db_orcl"</strong>
[oracle@el5 ~]$ </pre>
<p>Running <em>srvctl getenv</em> again shows the newly configured variables.</p>
<pre>[oracle@el5 ~]$ <strong>srvctl getenv database -d orcl</strong>
orcl:
ORACLE_SID=orcl
ORACLE_HOME=/u01/app/oracle/product/11.2.0/db_orcl
[oracle@el5 ~]$ </pre>
<p><br/><br />
<strong>Configuration maintenance</strong></p>
<p>Oracle Restart's configuration is stored into the Oracle Local Registry (OLR). OLR was introduced with 11gR2 and it is a repository similar to OCR, but is not shared among other RAC nodes. It is instead located on a local storage and holds information specific to the individual host.</p>
<p>You can check the status of OLR using the <em>ocrcheck</em> utility (you can find it in <em>/bin</em> in the Grid Infrastructure home).</p>
<pre>[root@el5 bin]# <strong>./ocrcheck -local</strong>
Status of Oracle Local Registry is as follows :
         Version                  :          3
         Total space (kbytes)     :     262120
         Used space (kbytes)      :       2384
         Available space (kbytes) :     259736
         ID                       : 1621070741
         Device/File Name         : /u01/app/oracle/product/11.2.0/grid/cdata/localhost/el5.olr
                                    Device/File integrity check succeeded

         Local registry integrity check succeeded

         Logical corruption check succeeded

[root@el5 bin]# </pre>
<p>If you are interested in what's in the OLR you can dump it to a file (or bring in on screen by using <em>-stdout</em> instead of a file name, but be careful - my OLR for this example was around 2300 lines).</p>
<pre>[root@el5 bin]# <strong>./ocrdump -local olr_export</strong>
[root@el5 bin]# <strong>cat olr_export</strong>
[SYSTEM]
UNDEF :
SECURITY : {USER_PERMISSION : PROCR_ALL_ACCESS, GROUP_PERMISSION : PROCR_READ, OTHER_PERMISSION : PROCR_READ, USER_NAME : oracle, GROUP_NAME : oinstall}

[SYSTEM.crs]
UNDEF :
SECURITY : {USER_PERMISSION : PROCR_ALL_ACCESS, GROUP_PERMISSION : PROCR_READ, OTHER_PERMISSION : PROCR_READ, USER_NAME : oracle, GROUP_NAME : oinstall}

…

[CRS]
UNDEF :
SECURITY : {USER_PERMISSION : PROCR_ALL_ACCESS, GROUP_PERMISSION : PROCR_READ, OTHER_PERMISSION : PROCR_READ, USER_NAME : oracle, GROUP_NAME : oinstall}

[root@el5 bin]# </pre>
<p>There is no automated backup for the Oracle Local Registry. Backups are taken only during install and upgrade processes. You can see a list of the OLR backups by using the <em>ocrconfig</em> command.</p>
<pre>[root@el5 bin]# <strong>./ocrconfig -local -showbackup</strong>

el5     2012/02/18 06:56:51     /u01/app/oracle/product/11.2.0/grid/cdata/el5/backup_20120218_065651.olr
[root@el5 bin]# </pre>
<p>You can take a manual backup of the repository at any time. This is done with the following command:</p>
<pre>[root@el5 bin]# <strong>./ocrconfig -local -manualbackup</strong>

el5     2012/03/04 07:49:06     /u01/app/oracle/product/11.2.0/grid/cdata/el5/backup_20120304_074906.olr

el5     2012/02/18 06:56:51     /u01/app/oracle/product/11.2.0/grid/cdata/el5/backup_20120218_065651.olr
[root@el5 bin]# </pre>
<p>Keep in mind that before restoring an OLR backup you should turn off the High Availability Services. </p>
<pre># crsctl stop crs
# ocrconfig -local -restore
<olr-backup>
# ocrcheck -local
# crsctl start crs</pre>
<p>There is no command to remove an entry for the backup of the OLR. The default behavior for OLR backups is to maintain only the 5 most recent backups. Although the older backups are not reported by the ocrconfig utility, they are still kept as an OS files. It is your responsibility to schedule some clean up for these files.</p>
<p><br/><br />
<strong>Final remarks</strong></p>
<p>You will be pleased to know Oracle Restart is integrated with Oracle Data Guard and the Data Guard Broker. When a database shutdown and restart is required in response to a role change request, Oracle Restart shuts down and restarts the database in an orderly fashion. Oracle Restart also ensures that, following a Data Guard role transition, all database services configured to run in the new database role are active and all services not configured to run in the new role are stopped.<br />
Another feature of Oracle Restart is that it uses Oracle Notification Services (ONS) and Oracle Advanced Queues to publish Fast Application Notification high availability events. This allows the clients to automate the failover to a standby database, when a service or instance goes down.</p>
<p>For more information you should check the "Oracle Restart Integration with Oracle Data Guard" and "Fast Application Notification with Oracle Restart" sections of the Oracle Database Administrator's Guide 11g Release 2 (11.2).</p>
<p>At the end, keep in mind that Oracle development has confirmed that Oracle Restart is only intended for managing of single-instance (non-RAC) 11.2 Oracle products only. This is described in Metalink note ID 954552.1. </p>
]]></content:encoded>
			<wfw:commentRss>http://manchev.org/2012/03/keeping-a-single-instance-database-up-with-oracle-restart/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>A failover database using Oracle Database 11g Standard Edition and File Watchers</title>
		<link>http://manchev.org/2012/01/a-failover-database-using-oracle-database-11g-standard-edition-and-file-watchers/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=a-failover-database-using-oracle-database-11g-standard-edition-and-file-watchers</link>
		<comments>http://manchev.org/2012/01/a-failover-database-using-oracle-database-11g-standard-edition-and-file-watchers/#comments</comments>
		<pubDate>Tue, 10 Jan 2012 19:51:10 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[News]]></category>
		<category><![CDATA[linkedin]]></category>

		<guid isPermaLink="false">http://manchev.org/?p=688</guid>
		<description><![CDATA[A wrote a HOWTO on building a failover database using Database Standard Edition at both ends and using file watchers to detect new archivelogs. The full text is available here.]]></description>
			<content:encoded><![CDATA[<p>A wrote a HOWTO on building a failover database using Database Standard Edition at both ends and using file watchers to detect new archivelogs. The full text is available <a href="http://manchev.org/2012/01/building-a-failover-database-using-oracle-database-11g-standard-edition-and-file-watchers/">here</a>. </p>
]]></content:encoded>
			<wfw:commentRss>http://manchev.org/2012/01/a-failover-database-using-oracle-database-11g-standard-edition-and-file-watchers/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Building a failover database using Oracle Database 11g Standard Edition and File Watchers</title>
		<link>http://manchev.org/2012/01/building-a-failover-database-using-oracle-database-11g-standard-edition-and-file-watchers/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=building-a-failover-database-using-oracle-database-11g-standard-edition-and-file-watchers</link>
		<comments>http://manchev.org/2012/01/building-a-failover-database-using-oracle-database-11g-standard-edition-and-file-watchers/#comments</comments>
		<pubDate>Tue, 10 Jan 2012 19:48:01 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Database 11g]]></category>
		<category><![CDATA[Oracle Linux]]></category>
		<category><![CDATA[11g]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[failover]]></category>
		<category><![CDATA[linux]]></category>

		<guid isPermaLink="false">http://manchev.org/?p=659</guid>
		<description><![CDATA[We are all aware of Data Guard and the various disaster protection mechanisms that come with Oracle Database Enterprise Edition. In this article I will try to show you how to build a remote failover database, when all you have &#8230;<p class="read-more"><a href="http://manchev.org/2012/01/building-a-failover-database-using-oracle-database-11g-standard-edition-and-file-watchers/">Read more &#187;</a></p>]]></description>
			<content:encoded><![CDATA[<p>We are all aware of Data Guard and the various disaster protection mechanisms that come with Oracle Database Enterprise Edition. In this article I will try to show you how to build a remote failover database, when all you have are Standard Edition databases at both ends.</p>
<p>If we want to keep an exact replica of a production database we have to take care for three things. First, we have to ship the changes (archive logs) to the failover database. Second, we have to keep track of what was shipped, so we know what needs to be recovered if something goes wrong. Third, we have to apply the changes at the failover database.</p>
<p>Before 11gR2 came out, detecting and shipping log files between hosts had to be done outside of the database. In GNU/Linux environments most people use <em>rsync</em> or a similar program to do the job. On the other hand I always prefer to do such tasks within the database and relaying on the OS is not always an option (what if one of the databases runs on Windows?). In this tutorial I will show you how to pickup archivelogs by using File Watchers (introduced in 11gR2) and transfer them via FTP to a remote host.</p>
<p><strong>Demonstration scenario</strong></p>
<p>I will be using two hosts, both running Oracle Linux 5.5. The one with the production database is called <em>el5-prd</em> and the one that will host the failover database is called <em>el5-backup</em>. The production host has Database 11gR2 installed. There is a default database configured and it includes the sample schemas. The <em>el5-backup</em> has only the Oracle software installed. Both installations reside in <em>/u01/app/oracle/product/11.2.0/db_orcl</em> and the software owner is user <em>oracle</em>.</p>
<p><a href="http://manchev.org/wp-content/uploads/2012/01/dg_db_se.png"><img class="aligncenter size-full wp-image-661" title="Building Failover Database with Standard Edition" src="http://manchev.org/wp-content/uploads/2012/01/dg_db_se.png" alt="" width="337" height="182" /></a></p>
<p>We should perform the following steps to build the failover configuration:</p>
<p><a href="#1">1. Set the production database in archivelog mode.</a><br />
<a href="#2">2. Perform full database backup and create copies of control and parameter files.</a><br />
<a href="#3">3. Prepare the failover server for restore - setup database directories, copy the backup, control, parameter and password file. Create a listener file.</a><br />
<a href="#4">4. Restore the backup on <em>el5-backup</em>.</a><br />
<a href="#5">5. Install <em>ftpd</em> on <em>el5-backup</em>.</a><br />
<a href="#6">6. Setup ACLs for FTP transfer and install FTP packages on <em>el5-prd</em>.</a><br />
<a href="#7">7. Setup archivelog directory and test FTP transfer from the production host.</a><br />
<a href="#8">8. Setup a file watcher on <em>el5-prd</em>.</a><br />
<a href="#9">9. Test that archivelogs are shipped.</a><br />
<a href="#10">10. Setup a mechanism to apply &#038; delete the shipped logs on <em>el5-backup</em>.</a></p>
<p>The list is quite long, so let's begin.</p>
<p><strong id="1">Set the production database in archivelog mode</strong></p>
<p>First we have to create an OS directory, where the database should write the archivelogs.</p>
<p>Login to the production hosts as the oracle software owner and create an empty directory. I will create a directory named <em>archivelog</em> in my FRA.</p>
<pre>[oracle@el5-prd ~]$ <strong>mkdir /u01/app/oracle/fast_recovery_area/ORCL/archivelog</strong>
[oracle@el5-prd ~]$</pre>
<p>Next, put the database in archivelog mode.</p>
<pre>[oracle@el5-prd]$ <strong>sqlplus / as sysdba</strong>
SQL*Plus: Release 11.2.0.3.0 Production on Wed Dec 14 07:24:02 2011
Copyright (c) 1982, 2011, Oracle.  All rights reserved.
Connected to:
Oracle Database 11g Release 11.2.0.3.0 - Production

SQL> <strong>alter system set log_archive_dest_1='LOCATION=/u01/app/oracle/fast_recovery_area/ORCL/archivelog/' scope=spfile;</strong>

System altered.

SQL> <strong>alter system set log_archive_format='%t_%s_%r.arc' scope=spfile;</strong>

System altered.

SQL> <strong>shutdown immediate</strong>
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> <strong>startup mount</strong>
ORACLE instance started.

Total System Global Area  422670336 bytes
Fixed Size                  1345380 bytes
Variable Size             264243356 bytes
Database Buffers          150994944 bytes
Redo Buffers                6086656 bytes
Database mounted.
SQL> <strong>alter database archivelog;</strong>

Database altered.

SQL> <strong>alter database open;</strong>

Database altered.

SQL> <strong>alter database force logging;</strong>

Database altered.

SQL> <strong>exit</strong>
Disconnected from Oracle Database 11g Release 11.2.0.3.0 - Production
[oracle@el5-prd]$</pre>
<p><strong id="2">Perform full database backup and create copies of control and parameter files</strong></p>
<p>We perform a full backup of the production database by using RMAN.</p>
<pre>[oracle@el5-prd ~]$ <strong>rman target=/</strong>

Recovery Manager: Release 11.2.0.3.0 - Production on Sat Dec 10 14:24:16 2011

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

connected to target database: ORCL (DBID=1297199097)

RMAN> <strong>backup database plus archivelog;</strong>

Starting backup at 10-DEC-11
current log archived
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=40 device type=DISK
channel ORA_DISK_1: starting archived log backup set
channel ORA_DISK_1: specifying archived log(s) in backup set
input archived log thread=1 sequence=6 RECID=1 STAMP=769530270
channel ORA_DISK_1: starting piece 1 at 10-DEC-11
channel ORA_DISK_1: finished piece 1 at 10-DEC-11
piece handle=/u01/app/oracle/fast_recovery_area/ORCL/backupset/2011_12_10/o1_mf_annnn_TAG20111210T142431_7g6mw03l_.bkp tag=TAG20111210T142431 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 10-DEC-11

Starting backup at 10-DEC-11
using channel ORA_DISK_1
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
input datafile file number=00001 name=/u01/app/oracle/oradata/orcl/system01.dbf
input datafile file number=00002 name=/u01/app/oracle/oradata/orcl/sysaux01.dbf
input datafile file number=00005 name=/u01/app/oracle/oradata/orcl/example01.dbf
input datafile file number=00003 name=/u01/app/oracle/oradata/orcl/undotbs01.dbf
input datafile file number=00004 name=/u01/app/oracle/oradata/orcl/users01.dbf
channel ORA_DISK_1: starting piece 1 at 10-DEC-11
channel ORA_DISK_1: finished piece 1 at 10-DEC-11
piece handle=/u01/app/oracle/fast_recovery_area/ORCL/backupset/2011_12_10/o1_mf_nnndf_TAG20111210T142433_7g6mw1lw_.bkp tag=TAG20111210T142433 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:01:26
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
including current control file in backup set
including current SPFILE in backup set
channel ORA_DISK_1: starting piece 1 at 10-DEC-11
channel ORA_DISK_1: finished piece 1 at 10-DEC-11
piece handle=/u01/app/oracle/fast_recovery_area/ORCL/backupset/2011_12_10/o1_mf_ncsnf_TAG20111210T142433_7g6mytqr_.bkp tag=TAG20111210T142433 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 10-DEC-11

Starting backup at 10-DEC-11
current log archived
using channel ORA_DISK_1
channel ORA_DISK_1: starting archived log backup set
channel ORA_DISK_1: specifying archived log(s) in backup set
input archived log thread=1 sequence=7 RECID=2 STAMP=769530364
channel ORA_DISK_1: starting piece 1 at 10-DEC-11
channel ORA_DISK_1: finished piece 1 at 10-DEC-11
piece handle=/u01/app/oracle/fast_recovery_area/ORCL/backupset/2011_12_10/o1_mf_annnn_TAG20111210T142604_7g6myw91_.bkp tag=TAG20111210T142604 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 10-DEC-11

RMAN> <strong>exit</strong>

Recovery Manager complete.
[oracle@el5-prd ~]$</pre>
<p>Next we create copies of the control and parameter file, placing them in the oracle user home directory.</p>
<pre>[oracle@el5-prd]$ <strong>sqlplus / as sysdba</strong>

SQL*Plus: Release 11.2.0.3.0 Production on Sat Dec 10 14:28:45 2011

Copyright (c) 1982, 2011, Oracle.  All rights reserved.

Connected to:
Oracle Database 11g Release 11.2.0.3.0 - Production

SQL> <strong>alter database create standby controlfile as '/home/oracle/orcl-backup.ctl'; </strong>
Database altered.

SQL> create pfile='/home/oracle/initORCL-backup.ora' from spfile;

File created.

SQL></pre>
<p><strong id="3">Prepare the failover server for restore</strong></p>
<p>After you have completed a "software only" installation of Database 11gR2 you have to create the following directories that are needed for successfully restoring the database backup:</p>
<pre>[oracle@el5-backup ~]$ <strong>mkdir -p /u01/app/oracle/oradata/ORCL</strong>
[oracle@el5-backup ~]$ <strong>mkdir -p /u01/app/oracle/fast_recovery_area/ORCL</strong>
[oracle@el5-backup ~]$ <strong>mkdir -p /u01/app/oracle/admin/ORCL/adump</strong></pre>
<p>Next we take the control file copy from the production server.</p>
<pre>[oracle@el5-backup ~]$ <strong>scp oracle@el5-prd:/home/oracle/orcl-backup.ctl /u01/app/oracle/oradata/ORCL/control01.ctl</strong>
oracle@el5-prd's password:
orcl-backup.ctl                               100% 9520KB   9.3MB/s   00:01
[oracle@el5-backup ~]$</pre>
<p>Another copy of the control file goes to the FRA.</p>
<pre>[oracle@el5-backup ~]$ <strong>cp /u01/app/oracle/oradata/ORCL/control01.ctl /u01/app/oracle/fast_recovery_area/ORCL/control02.ctl</strong>
[oracle@el5-backup ~]$</pre>
<p>We also need the parameter and the password file.</p>
<pre>[oracle@el5-backup ~]$ <strong>scp oracle@el5-prd:/home/oracle/initORCL-backup.ora /home/oracle/</strong>
oracle@el5-prd's password:
initORCL-backup.ora                           100%  945     0.9KB/s   00:00
[oracle@el5-backup ~]$ <strong>scp -r oracle@el5-prd:/u01/app/oracle/product/11.2.0/db_orcl/dbs/orapwORCL /u01/app/oracle/product/11.2.0/db_orcl/dbs/orapwORCL</strong>
oracle@el5-prd's password:
orapwORCL                                     100% 1536     1.5KB/s   00:00
[oracle@el5-backup ~]$</pre>
<p>Let's copy the archivelogs and the backup as well.</p>
<pre>[oracle@el5-backup ~]$ <strong>scp -r oracle@el5-prd:/u01/app/oracle/fast_recovery_area/ORCL/archivelog /u01/app/oracle/fast_recovery_area/ORCL/</strong>
oracle@el5-prd's password:
o1_mf_1_7_7g7hwtfw_.arc                       100%   23KB  22.5KB/s   00:00
o1_mf_1_6_7g7hs8tx_.arc                       100% 4085KB   4.0MB/s   00:00
[oracle@el5-backup ~]$
[oracle@el5-backup ~]$ <strong>scp -r oracle@el5-prd:/u01/app/oracle/fast_recovery_area/ORCL/backupset /u01/app/oracle/fast_recovery_area/ORCL/</strong>
oracle@el5-prd's password:
o1_mf_annnn_TAG20111210T222058_7g7hsbnq_.bkp  100% 4086KB   4.0MB/s   00:00
o1_mf_annnn_TAG20111210T222250_7g7hwv01_.bkp  100%   24KB  24.0KB/s   00:00
o1_mf_ncsnf_TAG20111210T222059_7g7hws7f_.bkp  100% 9600KB   9.4MB/s   00:00
o1_mf_nnndf_TAG20111210T222059_7g7hsdkp_.bkp  100% 1172MB  13.6MB/s   01:26
[oracle@el5-backup ~]$</pre>
<p>The final set of files are the redo log files.</p>
<pre>[oracle@el5-backup ~]$ <strong>scp oracle@el5-prd:/u01/app/oracle/oradata/ORCL/redo* /u01/app/oracle/oradata/ORCL</strong>
oracle@el5-prd's password:
redo01.log                                    100%   50MB  16.7MB/s   00:03
redo02.log                                    100%   50MB  25.0MB/s   00:02
redo03.log                                    100%   50MB  10.0MB/s   00:05
[oracle@el5-backup ~]$</pre>
<p>The last thing we have to do is to create a listener.ora file.</p>
<pre>[oracle@el5-backup ~]$ <strong>cat >> /u01/app/oracle/product/11.2.0/db_orcl/network/admin/listener.ora << EOF > LISTENER = > (DESCRIPTION_LIST = > (DESCRIPTION = > (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521)) > (ADDRESS = (PROTOCOL = TCP)(HOST = el5-backup)(PORT = 1521)) > ) > ) > > ADR_BASE_LISTENER = /u01/app/oracle > EOF</strong>
[oracle@el5-backup ~]$</pre>
<p>As you can see, the listener for our failover database will use the default 1521 port. Time to restore from the backup.</p>
<p><strong id="4">Restore the backup on el5-backup</strong></p>
<p>Before running the restore we have to start up and bring the failover database to a mount state. The first step is to start the listener on <em>el5-backup</em>.</p>
<pre>[oracle@el5-backup ~]$ <strong>lsnrctl start</strong>

LSNRCTL for Linux: Version 11.2.0.3.0 - Production on 10-DEC-2011 22:45:13

Copyright (c) 1991, 2011, Oracle.  All rights reserved.

Starting /u01/app/oracle/product/11.2.0/db_orcl/bin/tnslsnr: please wait...

TNSLSNR for Linux: Version 11.2.0.3.0 - Production
System parameter file is /u01/app/oracle/product/11.2.0/db_orcl/network/admin/listener.ora
Log messages written to /u01/app/oracle/diag/tnslsnr/el5-backup/listener/alert/log.xml
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=el5-backup)(PORT=1521)))

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 11.2.0.3.0 - Production
Start Date                10-DEC-2011 22:45:15
Uptime                    0 days 0 hr. 0 min. 0 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /u01/app/oracle/product/11.2.0/db_orcl/network/admin/listener.ora
Listener Log File         /u01/app/oracle/diag/tnslsnr/el5-backup/listener/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=el5-backup)(PORT=1521)))
The listener supports no services
The command completed successfully
[oracle@el5-backup ~]$</pre>
<p>Next we have to set the SID and create a SPFILE from the paramater file that we have in our home directory.</p>
<pre>[oracle@el5-backup ~]$ <strong>export ORACLE_SID=ORCL</strong>
[oracle@el5-backup ~]$ <strong>sqlplus / as sysdba</strong>

SQL*Plus: Release 11.2.0.3.0 Production on Sat Dec 10 22:45:52 2011

Copyright (c) 1982, 2011, Oracle.  All rights reserved.

Connected to an idle instance.

SQL> <strong>create spfile from pfile='/home/oracle/initORCL-backup.ora';</strong>

File created.

SQL></pre>
<p>We can now restore the database by using RMAN.</p>
<pre>[oracle@el5-backup ~]$ <strong>rman target=/</strong>

Recovery Manager: Release 11.2.0.3.0 - Production on Sat Dec 10 22:47:11 2011

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

connected to target database (not started)

RMAN> <strong>startup mount;</strong>

Oracle instance started
database mounted

Total System Global Area     422670336 bytes

Fixed Size                     1345380 bytes
Variable Size                268437660 bytes
Database Buffers             146800640 bytes
Redo Buffers                   6086656 bytes

RMAN> <strong>restore database;</strong>

Starting restore at 10-DEC-11
Starting implicit crosscheck backup at 10-DEC-11
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=18 device type=DISK
Crosschecked 4 objects
Finished implicit crosscheck backup at 10-DEC-11

Starting implicit crosscheck copy at 10-DEC-11
using channel ORA_DISK_1
Finished implicit crosscheck copy at 10-DEC-11

searching for all files in the recovery area
cataloging files...
cataloging done

List of Cataloged Files
=======================
File Name: /u01/app/oracle/fast_recovery_area/ORCL/archivelog/2011_12_10/o1_mf_1_7_7g7hwtfw_.arc
File Name: /u01/app/oracle/fast_recovery_area/ORCL/archivelog/2011_12_10/o1_mf_1_6_7g7hs8tx_.arc

using channel ORA_DISK_1

channel ORA_DISK_1: starting datafile backup set restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_DISK_1: restoring datafile 00001 to /u01/app/oracle/oradata/ORCL/system01.dbf
channel ORA_DISK_1: restoring datafile 00002 to /u01/app/oracle/oradata/ORCL/sysaux01.dbf
channel ORA_DISK_1: restoring datafile 00003 to /u01/app/oracle/oradata/ORCL/undotbs01.dbf
channel ORA_DISK_1: restoring datafile 00004 to /u01/app/oracle/oradata/ORCL/users01.dbf
channel ORA_DISK_1: restoring datafile 00005 to /u01/app/oracle/oradata/ORCL/example01.dbf
channel ORA_DISK_1: reading from backup piece /u01/app/oracle/fast_recovery_area/ORCL/backupset/2011_12_10/o1_mf_nnndf_TAG20111210T222059_7g7hsdkp_.bkp
channel ORA_DISK_1: piece handle=/u01/app/oracle/fast_recovery_area/ORCL/backupset/2011_12_10/o1_mf_nnndf_TAG20111210T222059_7g7hsdkp_.bkp tag=TAG20111210T222059
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:01:36
Finished restore at 10-DEC-11

RMAN> <strong>exit</strong>

Recovery Manager complete.
[oracle@el5-backup ~]$</pre>
<p>We successfully created an identical copy of the production database.</p>
<p><strong id="5">Install ftpd on el5-backup</strong></p>
<p>Installing the FTP daemon on Oracle Linux is pretty straightforward.</p>
<pre>[root@el5-backup ~]# <strong>yum install vsftpd</strong>
Loaded plugins: security
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package vsftpd.i386 0:2.0.5-16.el5_4.1 set to be updated
--> Finished Dependency Resolution

Dependencies Resolved

================================================================================
 Package        Arch         Version                  Repository           Size
================================================================================
Installing:
 vsftpd         i386         2.0.5-16.el5_4.1         el5_u5_base         140 k

Transaction Summary
================================================================================
Install       1 Package(s)
Upgrade       0 Package(s)

Total download size: 140 k
Is this ok [y/N]: <strong>Y</strong>
Downloading Packages:
vsftpd-2.0.5-16.el5_4.1.i386.rpm                         | 140 kB     00:01
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing     : vsftpd                                                   1/1

Installed:
  vsftpd.i386 0:2.0.5-16.el5_4.1

Complete!
[root@el5-backup ~]#</pre>
<p>You should not forget to reconfigure the firewall on the failover server to allow FTP communication. First add <em>ip_conntrack_ftp</em> to the IPTABLES_MODULES line in <em>/etc/sysconfig/iptables-config</em>. The line in <em>iptables-config</em> should look like this:</p>
<pre>IPTABLES_MODULES="ip_conntrack_netbios_ns <strong>ip_conntrack_ftp</strong>"</pre>
<p>Next, edit <em>/etc/sysconfig/iptables</em> and add a rule for the FTP traffic (be sure to put the line before the REJECT rule). The line you have to add in <em>iptables</em> looks like this:</p>
<pre>-A RH-Firewall-1-INPUT -m state --state NEW -p tcp --dport 21 -j ACCEPT</pre>
<p>Bounce iptables and set the FTP service to autostart with the server.</p>
<pre>[root@el5-backup ~]# <strong>service iptables restart</strong>
Flushing firewall rules:                                   [  OK  ]
Setting chains to policy ACCEPT: filter                    [  OK  ]
Unloading iptables modules:                                [  OK  ]
Applying iptables firewall rules:                          [  OK  ]
Loading additional iptables modules: ip_conntrack_netbios_n[  OK  ]
[root@el5-backup ~]# <strong>chkconfig vsftpd on</strong>
[root@el5-backup ~]# <strong>service vsftpd start</strong>
Starting vsftpd for vsftpd:                                [  OK  ]
[root@el5-backup ~]#</pre>
<p>You might want to test the access from <em>el5-prd</em> to the failover server.</p>
<pre>[oracle@el5-prd ~]$ <strong>ftp el5-backup</strong>
Connected to el5-backup.
220 (vsFTPd 2.0.5)
530 Please login with USER and PASS.
530 Please login with USER and PASS.
KERBEROS_V4 rejected as an authentication type
Name (el5-backup:oracle): <strong>oracle</strong>
331 Please specify the password.
Password:
230 Login successful.
Remote system type is UNIX.
Using binary mode to transfer files.
ftp> <strong>bye</strong>
221 Goodbye.
[oracle@el5-prd ~]$</pre>
<p><strong id="6">Setup ACLs for FTP transfer and install FTP packages on el5-prd</strong></p>
<p>Our next task is to prepare the production server for communicating with <em>el5-backup</em> over FTP. We start by creating a dedicated database user that will be used for shipping and tracking the archivelog files. I will name it <em>logship</em>.</p>
<pre>[oracle@el5-prd ~]$ <strong>sqlplus / as sysdba</strong>

SQL*Plus: Release 11.2.0.3.0 Production on Wed Dec 14 07:24:02 2011

Copyright (c) 1982, 2011, Oracle.  All rights reserved.

Connected to:
Oracle Database 11g Release 11.2.0.3.0 - Production

SQL> <strong>create user logship identified by logship;</strong>

User created.

SQL> <strong>grant connect, resource to logship;</strong>

Grant succeeded.

SQL></pre>
<p>Next we should configure an Access Control List (ACL) that will allow FTP connections to <em>el5-backup</em> for user <em>logship</em>. We have to use the CREATE_ACL, ADD_PRIVILEGE and ASSIGN_ACL procedures from the DBMS_NETWORK_ACL_ADMIN package. We will call the procedures with the following parameters:</p>
<pre>DBMS_NETWORK_ACL_ADMIN.CREATE_ACL (
    acl          => 'ftp.xml',
    description  => 'Allow FTP connections',
    principal    => 'SYSTEM',
    is_grant     => TRUE,
    privilege    => 'connect',
    start_date   => SYSTIMESTAMP,
    end_date     => NULL);

 DBMS_NETWORK_ACL_ADMIN.ADD_PRIVILEGE (
    acl         => 'ftp.xml',
    principal   => 'LOGSHIP',
    is_grant    => FALSE,
    privilege   => 'connect',
    position    => NULL,
    start_date  => NULL,
    end_date    => NULL);

  DBMS_NETWORK_ACL_ADMIN.ASSIGN_ACL (
    acl         => 'ftp.xml',
    host        => 'el5-backup',
    lower_port  => NULL,
    upper_port  => NULL);</pre>
<p>Here is an output of their execution:</p>
<pre>SQL> <strong>exec dbms_network_acl_admin.create_acl (acl => 'ftp.xml', description => 'Allow FTP connections', principal => 'LOGSHIP', is_grant => TRUE, privilege => 'connect', start_date => SYSTIMESTAMP,end_date => NULL);</strong>

PL/SQL procedure successfully completed.

SQL> <strong>exec dbms_network_acl_admin.add_privilege (acl => 'ftp.xml', principal => 'LOGSHIP', is_grant => FALSE, privilege => 'connect', position => NULL, start_date => NULL, end_date => NULL);</strong>

PL/SQL procedure successfully completed.

SQL> <strong>exec dbms_network_acl_admin.assign_acl (acl => 'ftp.xml', host => 'el5-backup', lower_port => NULL,upper_port => NULL);</strong>

PL/SQL procedure successfully completed.

SQL></pre>
<p>For connecting to <em>el5-backup</em> from the production database we will be using the <a href="http://www.oracle-base.com/articles/misc/FTPFromPLSQL.php">FTP API</a> developed by <a href="http://www.oracle-base.com/misc/SiteInfo.php">Tim Hall</a>. You need to download the <a href="http://www.oracle-base.com/dba/miscellaneous/ftp.pks">FTP package</a> and the <a href="http://www.oracle-base.com/dba/miscellaneous/ftp.pks">package body</a> creation scripts and run them as user <em>logship</em>.</p>
<pre>SQL> <strong>conn logship/logship;</strong>
Connected.
SQL> <strong>@ftp.pks;</strong>

Package created.

No errors.
SQL> <strong>@ftp.pkb;</strong>

Package body created.

No errors.
SQL></pre>
<p><strong id="7">Setup archivelog directory and test FTP transfer</strong></p>
<p>We move on by creating a directory object within the production database that points to the location of the archivelog files.</p>
<pre>[oracle@el5-prd ~]$ <strong>sqlplus / as sysdba</strong>

SQL*Plus: Release 11.2.0.3.0 Production on Sun Dec 11 08:44:57 2011

Copyright (c) 1982, 2011, Oracle.  All rights reserved.

Connected to:
Oracle Database 11g Release 11.2.0.3.0 - Production

SQL> <strong>create directory arc_dir as '/u01/app/oracle/fast_recovery_area/ORCL/archivelog';</strong>

Directory created.

SQL> <strong>grant read on directory arc_dir to logship;</strong>

Grant succeeded.

SQL></pre>
<p>It is a good idea to test the FTP communication from within the database. You can create a dummy test file in the <em>archivelog</em> dir:</p>
<pre>[oracle@el5-prd ~]$ <strong>cat >> /u01/app/oracle/fast_recovery_area/ORCL/archivelog/testfile.txt << EOF > FTP test file > EOF</strong>
[oracle@el5-prd ~]$</pre>
<p>You can then connect as user logship and run the following PL/SQL block:</p>
<pre>declare l_conn utl_tcp.connection;
begin
  l_conn := ftp.login('el5-backup','21','oracle','welcome1');
  ftp.put(p_conn => l_conn, p_from_dir  => 'ARC_DIR', p_from_file => 'testfile.txt', p_to_file => '/u01/app/oracle/fast_recovery_area/ORCL/archivelog/testfile.txt');
  ftp.logout(l_conn);
end;
/</pre>
<p>If everything goes fine the testfile.txt will appear at <em>el5-backup</em>.</p>
<pre>[oracle@el5-backup ~]$ <strong>cd /u01/app/oracle/fast_recovery_area/ORCL/archivelog/</strong>
[oracle@el5-backup archivelog]$ <strong>cat testfile.txt</strong>
FTP test file
[oracle@el5-backup archivelog]$</pre>
<p><strong id="8">Setup a file watcher on el5-prd</strong></p>
<p>We will be using a database File Watcher for detecting new archivelog files and triggering FTP transfer.<br />
First we login as user <em>logship</em> and create a table for storing detected archivelog files and the date of attempted transfer. This table is needed only for our own convinience - it can be used to check for missing log files if anything goes wrong.</p>
<pre>SQL> <strong>conn logship/logship;</strong>
Connected.
SQL> <strong>create sequence transfered_logs_seq start with 1 increment by 1 cache 20 nocycle;</strong>

Sequence created.

SQL> <strong>create table transfered_logs (id number, transfer_date date, file_name varchar2(4000), error char(1));</strong>

Table created.

SQL></pre>
<p>Next we set the file detection interval to 1 minute. Of course, you can tune this to match closer you archivelog generation interval.</p>
<pre>SQL> <strong>conn / as sysdba</strong>
Connected.
SQL> <strong>exec dbms_scheduler.set_attribute('file_watcher_schedule', 'repeat_interval', 'freq=minutely; interval=1');</strong>

PL/SQL procedure successfully completed.

SQL></pre>
<p>In order to have access to the archivelog directory, the file watcher needs an OS user account. We will create a credentials that the watcher can use and provide them with the <em>oracle</em>'s username and password. For my demo install the <em>oracle</em>'s password is <em>welcome1</em>.</p>
<pre>SQL> <strong>exec dbms_scheduler.create_credential(credential_name => 'local_credential', username => 'oracle', password => 'welcome1');</strong>

PL/SQL procedure successfully completed.

SQL></pre>
<p>The final preparation is to create a PL/SQL procedure that the file watcher will call upon detecting a new archivelog file. The procedure I am using looks like this:</p>
<pre>create or replace procedure trasnfer_arc_log(p_sched_result SYS.SCHEDULER_FILEWATCHER_RESULT) as
  v_transfer_id		number;
  v_file_name		varchar2(4000);
  v_ftp_conn		utl_tcp.connection;
begin
  v_transfer_id := transfered_logs_seq.nextval;
  v_file_name := p_sched_result.actual_file_name;
  v_ftp_conn := ftp.login('el5-backup','21','oracle','welcome1');
  ftp.put(p_conn => v_ftp_conn, p_from_dir  => 'ARC_DIR', p_from_file => v_file_name, p_to_file => '/u01/app/oracle/fast_recovery_area/ORCL/archivelog/'||v_file_name);
  ftp.logout(v_ftp_conn);
  insert into transfered_logs values (v_transfer_id, sysdate, v_file_name, null);
  commit;
exception when others then
  insert into transfered_logs values (v_transfer_id, sysdate, v_file_name, 'Y');
  commit;
end;
/</pre>
<p>This procedure will try to ftp the file that the watcher will pass to it. If the operation is successful the procedure will insert a record in the TRANSFERED_LOGS table with the file name and date and time of its transfer. If an error occurs the procedure will set the ERROR column for the record to "Y".</p>
<p>Let's create this procedure in the <em>logship</em> schema.</p>
<pre>SQL> <strong>conn logship/logship</strong>
Connected.
SQL> <strong>create or replace procedure trasnfer_arc_log(p_sched_result SYS.SCHEDULER_FILEWATCHER_RESULT) as 2 v_transfer_id number; 3 v_file_name varchar2(4000); 4 v_ftp_conn utl_tcp.connection; 5 begin 6 v_transfer_id := transfered_logs_seq.nextval; 7 v_file_name := p_sched_result.actual_file_name; 8 v_ftp_conn := ftp.login('el5-backup','21','oracle','welcome1'); 9 ftp.put(p_conn => v_ftp_conn, p_from_dir => 'ARC_DIR', p_from_file => v_file_name, p_to_file => '/u01/app/oracle/fast_recovery_area/ORCL/archivelog/'||v_file_name); 10 ftp.logout(v_ftp_conn); 11 insert into transfered_logs values (v_transfer_id, sysdate, v_file_name, null); 12 commit; 13 exception when others then 14 insert into transfered_logs values (v_transfer_id, sysdate, v_file_name, 'Y'); 15 commit; 16 end; 17 /</strong>

Procedure created.

SQL> <strong>show errors</strong>
No errors.
SQL></pre>
<p>Time to create the file watcher. This is done by calling the CREATE_FILE_WATCHER procedure from the DBMS_SCHEDULER package. I call the procedure with the following parameters.</p>
<pre>BEGIN
  DBMS_SCHEDULER.create_file_watcher(
    file_watcher_name => 'arc_watcher',
    directory_path    => '/u01/app/oracle/fast_recovery_area/ORCL/archivelog',
    file_name         => '*.arc',
    credential_name   => 'local_credential',
    destination       => NULL,
    enabled           => FALSE);
END;
/</pre>
<p>Here is the execution:</p>
<pre>SQL> <strong>conn / as sysdba</strong>
Connected.
SQL> <strong>exec dbms_scheduler.create_file_watcher(file_watcher_name => 'arc_watcher', directory_path => '/u01/app/oracle/fast_recovery_area/ORCL/archivelog', file_name => '*.arc', credential_name => 'local_credential', destination => NULL, enabled => FALSE);</strong>

PL/SQL procedure successfully completed.

SQL></pre>
<p>Next we create a program that will bind the file watcher and the TRANSFER_ARC_LOG PL/SQL procedure.</p>
<pre>SQL> <strong>exec dbms_scheduler.create_program(program_name => 'arc_watcher_prog', program_type => 'stored_procedure', program_action => 'logship.trasnfer_arc_log', number_of_arguments => 1, enabled => FALSE);</strong>

PL/SQL procedure successfully completed.

SQL> <strong>exec dbms_scheduler.define_metadata_argument(program_name => 'arc_watcher_prog', metadata_attribute => 'event_message', argument_position => 1);</strong>

PL/SQL procedure successfully completed.

SQL></pre>
<p>The final touch is creating a job for the ARC_WATCHER_PROG.</p>
<pre>SQL> <strong>exec dbms_scheduler.create_job(job_name => 'arc_watcher_job', program_name => 'arc_watcher_prog', event_condition => NULL, queue_spec => 'arc_watcher', auto_drop => FALSE, enabled => FALSE);</strong>

PL/SQL procedure successfully completed.

SQL></pre>
<p>An important step is to set a value for the PARALLEL_INSTANCES attribute for our job. We will set this to TRUE to let the scheduler run multiple instances of our job. If you omit this step the system will process archivelogs one a time and if it's busy with a file it will just ignore any new archivelogs that appear in this period. You definitely do not want this to happen.</p>
<pre>SQL> <strong>exec dbms_scheduler.set_attribute('arc_watcher_job','parallel_instances',TRUE);</strong>

PL/SQL procedure successfully completed.

SQL></pre>
<p>As finally everything is in place, we can enable the watcher, its program and the job. This is done by executing the DBMS_SCHEDULER.ENABLE procedure.</p>
<pre>SQL> <strong>exec dbms_scheduler.enable('arc_watcher');</strong>

PL/SQL procedure successfully completed.

SQL> <strong>exec dbms_scheduler.enable('arc_watcher_prog');</strong>

PL/SQL procedure successfully completed.

SQL> <strong>exec dbms_scheduler.enable('arc_watcher_job');</strong>

PL/SQL procedure successfully completed.

SQL></pre>
<p><strong id="9">Test that archivelogs are shipped</strong></p>
<p>For testing if archivelog transfers are happening we will take a look at the archivelog directory on failover server.</p>
<pre>[oracle@el5-backup ~]$ <strong>ls -la /u01/app/oracle/fast_recovery_area/ORCL/archivelog/</strong>
total 5664
drwxr-xr-x 2 oracle oinstall    4096 Dec 27 07:56 .
drwxr-xr-x 4 oracle oinstall    4096 Dec 27 07:22 ..
-rw-r----- 1 oracle oinstall 1043968 Dec 27 07:52 1_10_769951554.arc
-rw-r----- 1 oracle oinstall 1701888 Dec 27 07:52 1_7_769951554.arc
-rw-r----- 1 oracle oinstall  544256 Dec 27 07:52 1_8_769951554.arc
-rw-r----- 1 oracle oinstall 2481152 Dec 27 07:52 1_9_769951554.arc
[oracle@el5-backup ~]$</pre>
<p>We then execute ALTER SYSTEM SWITCH LOGFILE on el5-prd.</p>
<pre>SQL> <strong>alter system switch logfile;</strong>

System altered.

SQL></pre>
<p>We connect with the logship user and check the contents of TRANSFERED_LOGS.</p>
<pre>SQL> <strong>conn logship/logship;</strong>
Connected.
SQL> <strong>select count(*) from transfered_logs;</strong>

  COUNT(*)
----------
         0

SQL></pre>
<p>OK, the archivelog directory is checked in 60 seconds interval, so you might have to wait some more. After one minute tops the new file should be detected and transferred.</p>
<pre>SQL> <strong>select count(*) from transfered_logs;</strong>

  COUNT(*)
----------
         1

SQL></pre>
<p>The new log is detected in a transfer attempt was made. Check the <em>archivelog</em> directory on <em>el5-backup</em> again to see if the file is there.</p>
<pre>[oracle@el5-backup ~]$ <strong>ls -la /u01/app/oracle/fast_recovery_area/ORCL/archivelog/</strong>
total 6920
drwxr-xr-x 2 oracle oinstall    4096 Dec 27 08:00 .
drwxr-xr-x 4 oracle oinstall    4096 Dec 27 07:22 ..
-rw-r----- 1 oracle oinstall 1043968 Dec 27 07:52 1_10_769951554.arc
<span style="color: #ff0000;"><strong>-rw-r--r-- 1 oracle oinstall 1282048 Dec 27 08:00 1_11_769951554.arc</strong></span>
-rw-r----- 1 oracle oinstall 1701888 Dec 27 07:52 1_7_769951554.arc
-rw-r----- 1 oracle oinstall  544256 Dec 27 07:52 1_8_769951554.arc
-rw-r----- 1 oracle oinstall 2481152 Dec 27 07:52 1_9_769951554.arc
[oracle@el5-backup ~]$</pre>
<p>The logfile appears as expected. This concludes the detect and transfer part of our configuration.</p>
<p><strong id="10">A mechanism to apply and delete the shipped logs</strong></p>
<p>Having the log files transferred to a failover server is not enough. If you really want to have an identical copy that is ready to take over the primary role you should take care to apply the database changes described in the logs. The easiest way is to simply start RMAN and apply the log files manually.</p>
<pre>[oracle@el5-prd ~]$ <strong>rman target=/ </strong>
Recovery Manager: Release 11.2.0.3.0 - Production on Sat Dec 27 11:24:16 2011

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

connected to target database: ORCL (DBID=1297199097)

RMAN> <strong>recover database noredo;</strong>

Starting recover at 17-DEC-11
using channel ORA_DISK_1

Starting recover at 17-DEC-11
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=18 device type=DISK

starting media recovery

archived log for thread 1 with sequence 8 is already on disk as file /u01/app/oracle/fast_recovery_area/ORCL/archivelog/1_8_769951554.arc
archived log file name=/u01/app/oracle/fast_recovery_area/ORCL/archivelog/1_8_769951554.arc thread=1 sequence=8
archived log file name=/u01/app/oracle/fast_recovery_area/ORCL/archivelog/1_9_769951554.arc thread=1 sequence=9
archived log file name=/u01/app/oracle/fast_recovery_area/ORCL/archivelog/1_10_769951554.arc thread=1 sequence=10
archived log file name=/u01/app/oracle/fast_recovery_area/ORCL/archivelog/1_11_769951554.arc thread=1 sequence=11
unable to find archived log
archived log thread=1 sequence=12

Finished recover at 17-DEC-11</pre>
<p>You can then open the failover database and use in place of the production by executing</p>
<pre>alter database open resetlogs</pre>
<p>The thing is that you probably want to automate the process. This automation can not happen in the failover database as it is not really operational (it's not in open state). You will probably go with some kind of OS level automation, but this will be platform dependent.</p>
<p>For GNU/Linux environments, what you can do is to create a simple shell script that looks like this:</p>
<pre>rman target / nocatalog << EOF
run {
  recover database noredo;
  delete noprompt force archivelog until time 'SYSDATE-7';
}
exit
EOF</pre>
<p>This script will call RMAN, apply the received archivelogs and delete all log files that are older than 7 days (I keep the others just in case). You can then setup a cron job to run the script at an appropriate interval and you should not worry for managing the archivelogs manually.</p>
<p><strong>Final remarks</strong></p>
<p>In this tutorial I showed you how to build a platform independant archivelogs shipping mecahnism, that does all the work from within the database. This approach has its limitations and it's not in anyway a substitution of Data Guard and the other recovery features of Enterprise Edition. It's just a simple workaround when you are forced to use Database SE and you are looking for a simple way to be more protected from failiures.</p>
<p>There are several areas for improvement in this mechanism, especially when it comes to security. You should keep in mind that FTP is not really secure, so if you're dealing with sensitive data you might want to consider using SFTP or something else that provides encryption. Another issue is keeping plaintext passwords in TRANSFER_ARC_LOG procedure (you might want to wrap this one) and the database dictionary.</p>
]]></content:encoded>
			<wfw:commentRss>http://manchev.org/2012/01/building-a-failover-database-using-oracle-database-11g-standard-edition-and-file-watchers/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>List of parameter changes in Oracle Database 11g</title>
		<link>http://manchev.org/2011/12/list-of-parameter-changes-in-oracle-database-11g/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=list-of-parameter-changes-in-oracle-database-11g</link>
		<comments>http://manchev.org/2011/12/list-of-parameter-changes-in-oracle-database-11g/#comments</comments>
		<pubDate>Tue, 06 Dec 2011 08:15:57 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[News]]></category>

		<guid isPermaLink="false">http://manchev.org/?p=654</guid>
		<description><![CDATA[I created a list of all instance parameter changes introduced in 11g. It includes all parameters introduced or announced deprecated/obsolete in 11.1,11.2.0.1, 11.2.0.2 and 11.2.0.3. The full list is available here.]]></description>
			<content:encoded><![CDATA[<p>I created a list of all instance parameter changes introduced in 11g. It includes all parameters introduced or announced deprecated/obsolete in 11.1,11.2.0.1, 11.2.0.2 and 11.2.0.3. The full list is available <a href="http://manchev.org/2011/12/initialization-parameter-changes-in-oracle-database-11g/">here</a>. </p>
]]></content:encoded>
			<wfw:commentRss>http://manchev.org/2011/12/list-of-parameter-changes-in-oracle-database-11g/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Initialization parameter changes in Oracle Database 11g</title>
		<link>http://manchev.org/2011/12/initialization-parameter-changes-in-oracle-database-11g/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=initialization-parameter-changes-in-oracle-database-11g</link>
		<comments>http://manchev.org/2011/12/initialization-parameter-changes-in-oracle-database-11g/#comments</comments>
		<pubDate>Mon, 05 Dec 2011 20:35:29 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Database 11g]]></category>
		<category><![CDATA[11g]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[oracle]]></category>

		<guid isPermaLink="false">http://manchev.org/?p=610</guid>
		<description><![CDATA[New initialization Parameters in Oracle Database 11g This list is built for my personal use and I do not guarantee that it is error free. I used almost exclusively the official Oracle documentation and some Metalink notes, where the official &#8230;<p class="read-more"><a href="http://manchev.org/2011/12/initialization-parameter-changes-in-oracle-database-11g/">Read more &#187;</a></p>]]></description>
			<content:encoded><![CDATA[<p><strong>New initialization Parameters in Oracle Database 11g</strong></p>
<p>This list is built for my personal use and I do not guarantee that it is error free. I used almost exclusively the official Oracle documentation and some Metalink notes, where the official docs where not clear enough. This list is also available for download as a <a href='http://manchev.org/wp-content/uploads/2011/12/11gNewParams.pdf'>PDF file</a>.</p>
<table>
<tr>
<th>Parameter</th>
<th>Description</th>
</tr>
<tr>
<td colspan="2"><strong>Introduced in Database 11g Release 1 (11.1)</strong></td>
</tr>
<tr>
<td>asm_preferred_read_failure_groups</td>
<td>A comma-delimited list of strings that specifies the failure groups that contain preferred read disks. This parameter is used on clustered ASM instances and is instance specific.<br />
Default: null</td>
</tr>
<tr>
<td>client_result_cache_lag</td>
<td>Specifies the amount of time (in milliseconds) that the client cache can lag behind any changes made to the database that affect the result set. Default is 3 seconds.<br />
Default: 3000</td>
</tr>
<tr>
<td>client_result_cache_size</td>
<td>Specifies the maximum size (in bytes) of the client result set cache. All OCI clients inherit this settings, but it can be overridden by the OCI_RESULT_CACHE_MAX_SIZE client configuration parameter. The default value (0) set the the result cache to disabled.<br />
Default: 0</td>
</tr>
<tr>
<td>commit_logging</td>
<td>Advanced parameter that is used to control how redo is batched by Log Writer. If set to IMMEDIATE, the database writes commit records to the disk immediately, generating an I/O operation for every commit. This is the default behavior if the parameter is not set. In BATCH mode the database buffers the redo information, thus several I/O operations are batched.<br />
Valid options: <em>immediate</em> or <em>batch</em><br />
Default: No default value</td>
</tr>
<tr>
<td>commit_wait</td>
<td>Advanced parameter used to control when the redo for a commit is flushed to the redo logs. This parameter is set on system, session and transaction level.<br />
<u>WAIT</u>: The commit records are immediately flushed do disk. Session does not return control until the records are written.<br />
<u>NOWAIT</u>: The database doesn't wait for the commit to succeed, but returns control to client right away.<br />
<u>FORCE_WAIT</u>: If set at system level, the database ignores session level settings and uses WAIT. If set at session level, the database ignores what is set in a transaction and uses WAIT.<br />
Default: No default value </td>
</tr>
<tr>
<td>control_management_pack_access</td>
<td>Specifies which management packs are available and should be active.<br />
Valid options: <em>none</em>, <em>diagnostic</em>, <em>diagnostic+tuning</em><br />
Default: diagnostic+tuning</td>
</tr>
<tr>
<td>db_lost_write_protect</td>
<td>Enables the lost write detection. Lost write occurs when the file system acknowledges that a data block is written, while in fact it still not permanently stored.<br />
<u>On primary databases</u>: TYPICAL - the instance logs buffer cache reads in the redo log (for read-write tablespaces); FULL - the instance logs buffer cache reads in the redo log (for read-write and read-only tablespaces);<br />
<u>On standby databases (or primary in media recovery)</u>: TYPICAL/FULL - the instance performs lost write detection;<br />
Valid options: <em>none</em>, <em>typical</em>, <em>full</em><br />
Default: none</td>
</tr>
<tr>
<td>db_securefile</td>
<td>Specifies if the instance treats LOB files as SecureFiles. NEVER - LOBs that are specified as SecureFiles are created as BasicFile LOBs; PERMITED - LOBs that are specified as SecureFiles are created as SecureFiles LOBs;  ALWAYS - All LOBs are created as SecureFile LOBs; IGNORE - SecureFiles and their options are ignored;<br />
Valid options: <em>never</em>, <em>permitted</em>, <em>always</em>, <em>ignore</em><br />
Default: permitted</td>
</tr>
<tr>
<td>db_ultra_safe</td>
<td>Specifies protection level values for set of other database parameters.<br />
<u>OFF</u>: No changes to  DB_BLOCK_CHECKING, DB_LOST_WRITE_PROTECT and DB_BLOCK_CHECKSUM, if they are explicitly set; otherwise they are set to default values;<br />
<u>DATA_ONLY</u>: DB_BLOCK_CHECKING is set to MEDIUM, DB_LOST_WRITE_PROTECT is set to TYPICAL, DB_BLOCK_CHECKSUM  is set to FULL;<br />
<u>DATA_AND_INDEX</u>: DB_BLOCK_CHECKING is set to FULL, DB_LOST_WRITE_PROTECT is set to TYPICAL, DB_BLOCK_CHECKSUM  is set to FULL;<br />
Default: off</td>
</tr>
<tr>
<td>ddl_lock_timeout</td>
<td>Specifies a time limit (in seconds) for how long the DDL statements will wait to acquire a lock. The default value is NOWAIT(0). If a lock can not be acquired in the specified amount of time an error is raised (ORA-00054).<br />
Valid options: 0 to 1000000<br />
Default: 0</td>
</tr>
<tr>
<td>diagnostic_dest</td>
<td>Specifies the diagnostics directory (ADR home). The instance generates trace, alert, core and incident files in this directory. Oracle recommends that RAC instances specify the same diagnostic_dest (pointing to a shared disk location).<br />
Default: Derived from $ORACLE_BASE</td>
</tr>
<tr>
<td>global_txn_processes</td>
<td>Specifies the initial number of GTXn processes, that Oracle uses to support global transactions (XA) in RAC environment. There is no need to manually set this parameter, as the database will automatically tune it according to its needs.<br />
Valid options: 1 to 20<br />
Default: 1</td>
</tr>
<tr>
<td>java_jit_enabled</td>
<td>Enables the Java JIT (JustInTime) compiler. Defaults to <em>true</em> for platforms, that support JIT; otherwise its value is <em>false</em>.<br />
Default: OS dependent</td>
</tr>
<tr>
<td>ldap_directory_sysauth</td>
<td>Enables (yes) or disables (no) directory-based authentication for users in the SYSDBA and SYSOPER groups.<br />
Valid options: <em>yes</em> or <em>no</em><br />
Default: no</td>
</tr>
<tr>
<td>memory_max_target</td>
<td>Specifies the maximum value to which the DBA can increase the memory_target parameter.<br />
Valid options: 0 to the size of physical memory available to the database<br />
Default: 0</td>
</tr>
<tr>
<td>memory_target</td>
<td>Specifies the amount of memory available to the database. The database automatically tunes the used memory to memory_target, allocating and releasing SGA and PGA memory as needed.<br />
Valid options: 152M to memory_max_target<br />
Default: 0</td>
</tr>
<tr>
<td>optimizer_capture_sql_plan_baselines</td>
<td>When set to <em>true</em>, enables the recognition of repeatable SQL statements and generation of SQL plan baselines for such statements.<br />
Default: false</td>
</tr>
<tr>
<td>optimizer_use_invisible_indexes</td>
<td>Enables/disables the use of invisible indexes. When set to <em>true</em>, invisible indexes are treated as normal indexes.<br />
Default: flase</td>
</tr>
<tr>
<td>optimizer_use_pending_statistics</td>
<td>In previous DB versions, the newly gathered optimizer statistics were immediately published. In 11g this behavior can be controlled and statistics can be kept in a pending state until they are published. This parameter specifies whether the optimizer uses statistics in pending state when compiling SQL statements.<br />
Default: false</td>
</tr>
<tr>
<td>optimizer_use_sql_plan_baselines</td>
<td>Specifies whether the optimizer will look for a SQL plan baseline for the SQL statement being compiled. If set to <em>true</em>, the optimizer will look for a plan in the  SQL Management Base and will cost each of the found plans, choosing the one with the lowest cost.<br />
Default: true</td>
</tr>
<tr>
<td>parallel_io_cap_enabled</td>
<td>If set to <em>true</em> the database will cap the default degree of parallelism to no greater than what the I/O system can support. The limits are calculated based on the results of the I/O calibration package (you should run DBMS_RESOURCE_MANAGER.CALIBRATE_IO )<br />
Default: false</td>
</tr>
<tr>
<td>plscope_settings</td>
<td>PL/Scope is a tool that collects data about identifiers in PL/SQL source code at compilation time, and makes this data available in static dictionary views (*_IDENTIFIERS). The identifier data collections is disabled by default. Collection can be set on system, session or per-library unit basis.<br />
Valid options: identifiers:none, identifiers:all<br />
Default: identifiers:none</td>
</tr>
<tr>
<td>redo_transport_user</td>
<td>The parameter is used to select a different user password for redo transport authentication by setting this parameter to the name of any user who has been granted the SYSOPER privilege. The default is to use the SYS user.<br />
Default: No default value </td>
</tr>
<tr>
<td>result_cache_max_result</td>
<td>Specifies the percentage of result_cache_max_size that a single result set can use.<br />
Valid options: 0 to 100<br />
Default: 5</td>
</tr>
<tr>
<td>result_cache_max_size</td>
<td>Sets the maximum amount of SGA memory that can be utilized by the Result Cache. Setting this to 0 disables the Result Cache.<br />
Valid options: 0 to OS system dependent value (should be rounded up to the multiple of 32 KB)<br />
Default: Automatically calculated according the SGA size.</td>
</tr>
<tr>
<td>result_cache_mode</td>
<td>The default behavior is to add the Result Cache operator only when the query contains hint (/*+ result_cache */). If set to <em>force</em>, the operator is added to the root of all SELECT statements.<br />
Valid options:manual, force<br />
Default: manual</td>
</tr>
<tr>
<td>result_cache_remote_expiration</td>
<td>Specifies a number of minutes that a cache result based on a remote object will remain valid in the Result Cache. Using the default makes the database to not cache results based on remote objects. Setting this parameter to a non-zero value can produce stale answers (if the remote object has been changed in the meantime).<br />
Default: 0</td>
</tr>
<tr>
<td>sec_case_sensitive_logon</td>
<td>Specifies whether the login passwords are case sensitive.<br />
Default: true</td>
</tr>
<tr>
<td>sec_max_failed_login_attempts</td>
<td>Specifies the number of failed login attempts that the server process tolerates, before it drops the client's connection.<br />
Valid options: 1 to unlimited<br />
Default: 10</td>
</tr>
<tr>
<td>sec_protocol_error_further_action</td>
<td>Specifies how the server process will act upon receiving a bad packet from a client.<br />
<u>CONTINUE</u>: The process will continue execution, ignoring the packet<br />
<u>(DELAY, number_of_seconds)</u>: The client connections is delayed for a <em>number_of_seconds</em>, before the process accepts its next request.<br />
<u>(DROP, bad_packets)</u>: If the number of bad packets reach the <em>bad_packets</em> value, the client connection is terminated.<br />
Valid options: CONTINUE, (DELAY, <em>number_of_seconds</em>), (DROP, <em>bad_packets</em>)<br />
Default: continue</td>
</tr>
<tr>
<td>sec_protocol_error_trace_action</td>
<td>Specifies the database actions when a bad packet is received from a possibly malicious client.<br />
<u>NONE</u>: Bad packets are ignored, no further actions are taken<br />
<u>TRACE</u>: A detailed trace file is generated for each bad packet.<br />
<u>LOG</u>: A minimal log message is sent to the alert log file.<br />
<u>ALERT</u>: An alert is sent via OEM.<br />
Valid options: none, trace, log, alert<br />
Default: trace</td>
</tr>
<tr>
<td>sec_return_server_release_banner</td>
<td>Specifies if the server returns complete database software information to clients (for OCI connections). Disabling the version information is done by setting this parameter to <em>true</em>.<br />
Default: false</td>
</tr>
<tr>
<td>xml_db_events</td>
<td>Enables or disables XML DB Repository events.<br />
Valid options: enable, disable<br />
Default: enable</td>
</tr>
<tr>
<td colspan="2"><strong>Introduced in Database 11g Release 2 (11.2.0.1)</strong></td>
</tr>
<tr>
<td>deferred_segment_creation</td>
<td>By default segments for non-partitioned tables and their dependent objects (LOBs, indexes) will not be created until the first row is inserted into the table. If set to <em>false</em>, the database will create the appropriate segments together with the database object creation.<br />
Default: true</td>
</tr>
<tr>
<td>dst_upgrade_insert_conv</td>
<td>Specifies whether or not internal operators will be allocated on top of TIMESTAMP WITH TIME ZONE (TSTZ) columns of tables which have not been upgraded during the upgrade window of daylight saving time patching for TIMESTAMP WITH TIME ZONE data. When DST_UPGRADE_INSERT_CONV is set to true during the upgrade window of the daylight saving time patching process:<br />
SELECT queries on tables with TSTZ data which have not been upgraded will use internal operators on top of TSTZ columns to present TSTZ data as if they were recorded using the new timezone translation rules.<br />
DML on tables with TSTZ data which have not been upgraded will use internal operators on top of TSTZ columns to ensure that the TSTZ data is recorded using the old timezone translation rules in order to be consistent with the existing TSTZ data in the same tables.<br />
Default: true</td>
</tr>
<tr>
<td>listener_networks</td>
<td>Specifies one or more sets of local &#038; remote listeners for cross-registration. All listeners within the same network_name will cross-register.<br />
Valid options:<br />
'((NAME=network_name)<br />
  (LOCAL_LISTENER=["]listener_address[,...]["])<br />
  [(REMOTE_LISTENER=["]listener_address[,...]["])])'<br />
 [,...]<br />
Default: No default value</td>
</tr>
<tr>
<td>parallel_degree_limit</td>
<td>Specifies how the optimizer will limit the degree of parallelism, when executing SQL queries, to ensure the parallel processes do not flood the system.<br />
<u>CPU</u>: Parallelism is limited by the number of CPUs and is calculated as parallel_threads_per_cpu * cpu_count * number of available instances<br />
<u>IO</u>: Parallelism is limited by the I/O capacity. Calculated as the total system throughput divided by the maximum I/O bandwidth per process. DBMS_RESOURCE_MANAGER.CALIBRATE_IO should be run before using this setting.<br />
<u><em>Integer</em></u>: A numeric value for this parameter specifies the maximum degree of parallelism the optimizer can choose for a SQL statement when automatic degree of parallelism is active. Automatic degree of parallelism is only enabled if parallel_degree_policy is set to <em>auto</em> or <em>limited</em>.<br />
Valid options: cpu, io, <em>integer</em><br />
Default: cpu</td>
</tr>
<tr>
<td>parallel_degree_policy</td>
<td>Specifies whether or not automatic degree of Parallelism, statement queuing, and in-memory parallel execution will be enabled.<br />
<u>MANUAL</u>: Disables automatic degree of parallelism, statement queuing, and in-memory parallel execution. This reverts the database behavior to 11.2.<br />
<u>LIMITED</u>: Statement queuing and in-memory parallel execution is disabled. Automatic degree of parallelism is enabled for statements that access tables or indexes using the PARALLEL clause.<br />
<u>AUTO</u>:  Automatic degree of parallelism, statement queuing, and in-memory parallel execution is enabled.<br />
Valid options: manual, limited, auto<br />
Default: manual</td>
</tr>
<tr>
<td>parallel_force_local</td>
<td>Setting the parameter to <em>true</em> restricts the parallel server processes so that they can only operate on the same RAC node where the query coordinator resides (the node on which the SQL statement was executed on).<br />
Default: false</td>
</tr>
<tr>
<td>parallel_min_time_threshold</td>
<td>Specifies the minimum execution time a statement should have before the statement is considered for automatic degree of parallelism (10 seconds by default). This parameter is only useful for queries that use automatic degree of parallelism.<br />
Valid options: auto, integer<br />
Default: auto</td>
</tr>
<tr>
<td>parallel_servers_target</td>
<td>Sets the number of parallel server processes allowed to run parallel statements before statement queuing will be used. When the number of parallel server processes reaches the value of parallel_server_target and parallel_degree_policy is set to <em>auto</em>, the database will start queuing the SQL statements requiring parallel execution.<br />
Valid options: 0 to parallel_max_servers<br />
Default: 4 * cpu_count * parallel_threads_per_cpu * active_instance_count </td>
</tr>
<tr>
<td colspan="3"><strong>Introduced in Database 11g Release 2 (11.2.0.2)</strong></td>
</tr>
<tr>
<td>cursor_bind_capture_destination</td>
<td>Sets the location at which bind variables that are captured from SQL cursors are stored.<br />
<u>OFF</u>: No bind variables are captured.<br />
<u>MEMORY</u>: Bind variables are captured to memory (V$ views)<br />
<u>MEMORY+DISK</u>: Bind variables are captured to memory and disk (V$ views, AWR)<br />
Valid options: off, memory, memory+disk<br />
Default: memory+disk</td>
</tr>
<tr>
<td>db_flash_cache_file</td>
<td>Specifies a filename for the flash memory or a disk group representing a collection of flash memory. This parameter should only be set in combination with db_flash_cache_size.<br />
Valid options: filename, diskgroup<br />
Default: No default value</td>
</tr>
<tr>
<td>db_flash_cache_size</td>
<td>Sets the Database Smart Flash Cache size. Specified only at instance startup. The Flash Cache is disabled by default (parameter is set to 0).<br />
Valid options: 0 to OS dependent<br />
Default: 0</td>
</tr>
<tr>
<td>db_unrecoverable_scn_tracking</td>
<td>Enables/disables the tracking of unrecoverable (NOLOGGING) direct-path inserts and load operators. Unrecoverable changes can be tracked via the V$DATAFILE view (UNRECOVERABLE_CHANGE#  and UNRECOVERABLE_TIME columns).<br />
Default: true</td>
</tr>
<tr>
<td colspan="3"><strong>Introduced in Database 11g Release 2 (11.2.0.3)</strong></td>
</tr>
<tr>
<td>awr_snapshot_time_offset</td>
<td>AWR snapshots normally start at the top of the hour (12:00, 1:00, 2:00, and so on). This parameter allows DBAs to specify an offset (in seconds) for the AWR snapshot start time. 1000000 denotes an automatic mode (the offset is calculated based on the DB name in order to distribute offset times for databases sharing the same server).<br />
Valid options: 0 - 3599 or 1000000<br />
Default: No default value</td>
</tr>
</table>
<p><strong>Deprecated Parameters in Database 11g</strong></p>
<table>
<tr>
<th>Parameter</th>
<th>Description</th>
</tr>
<tr>
<td colspan="2"><strong>Database 11g Release 1 (11.1)</strong></td>
</tr>
<tr>
<td>background_dump_dest</td>
<td rowspan="3">These parameters are ignored by Oracle Database 11g Release 1, which places trace and core files in a location controlled by the DIAGNOSTIC_DEST initialization parameter.</td>
</tr>
<tr>
<td>core_dump_dest</td>
</tr>
<tr>
<td>user_dump_dest</td>
</tr>
<tr>
<td>commit_write</td>
<td>Retained for backward compatibility only. This parameter is replaced by the COMMIT_LOGGING and COMMIT_WAIT parameters.</td>
</tr>
<tr>
<td>cursor_space_for_time</td>
<td>Lets you use more space for cursors in order to save time. This parameter is deprecated and is retained for backward compatibility only.</td>
</tr>
<tr>
<td>instance_groups</td>
<td>Provides functionality for restricting parallel query operations to a limited number of instances. This parameter is deprecated and is retained for backward compatibility only.</td>
</tr>
<tr>
<td>log_archive_local_first</td>
<td>Specifies when the archiver processes (ARCn) transmit redo data to remote standby database destinations. This parameter is deprecated and is retained for backward compatibility only.</td>
</tr>
<tr>
<td>plsql_debug</td>
<td>PLSQL_DEBUG specifies whether or not PL/SQL library units will be compiled for debugging. This parameter is deprecated and is retained for backward compatibility only.</td>
</tr>
<tr>
<td>plsql_v2_compatibility</td>
<td>PL/SQL Version 2 allows some abnormal behavior that Version 8 disallows. This parameter is deprecated and is retained for backward compatibility only.</td>
</tr>
<tr>
<td>remote_os_authent</td>
<td>REMOTE_OS_AUTHENT specifies whether remote clients will be authenticated with the value of the OS_AUTHENT_PREFIX parameter. This parameter is deprecated and is retained for backward compatibility only.</td>
</tr>
<tr>
<td>resource_manager_cpu_allocation</td>
<td>Sets the number of CPUs that Resource Manager should utilize. Default is 0. This parameter was introduced in 11.1.0.6 and deprecated in 11.1.0.7.</td>
</tr>
<tr>
<td>standby_archive_dest</td>
<td>STANDBY_ARCHIVE_DEST can be used to specify where archived logs received from a primary database are stored on a standby database. It is no longer necessary to set this parameter, because an appropriate location is automatically chosen. </td>
</tr>
<tr>
<td>transaction_lag</td>
<td>Attribute of the CQ_NOTIFICATION$_REG_INFO object. Can be used to specify the number of transactions/database changes, by which the client is willing to lag behind the database. </td>
</tr>
<tr>
<td colspan="2"><strong>Database 11g Release 2 (11.2)</strong></td>
</tr>
<tr>
<td>active_instance_count</td>
<td>ACTIVE_INSTANCE_COUNT enables you to designate one instance in a two-instance cluster as the primary instance and the other instance as the secondary instance. This parameter is deprecated and is retained for backward compatibility only.</td>
</tr>
<tr>
<td>parallel_io_cap_enabled</td>
<td>This parameter is replaced by the PARALLEL_DEGREE_LIMIT when set to IO.</td>
</tr>
</table>
<p><strong>Obsolete Parameters in Database 11g </strong></p>
<table>
<tr>
<th>Parameter</th>
<th>Description</th>
</tr>
<tr>
<td colspan="2"><strong>Database 11g Release 1 (11.1)</strong></td>
</tr>
<tr>
<td>ddl_wait_for_locks</td>
<td>Specifies whether DDL statements (such as ALTER TABLE ... ADD COLUMN) wait and complete instead of timing out if the statement is not able to acquire all required locks.</td>
</tr>
<tr>
<td>logmnr_max_persistent_sessions</td>
<td>Specifies the maximum number of persistent LogMiner mining sessions that are concurrently active when all sessions are mining redo logs generated by standalone instances.</td>
</tr>
<tr>
<td>plsql_compiler_flags</td>
<td>Specifies a list of flags for the PL/SQL compiler as a comma-separated list of strings.</td>
</tr>
<tr>
<td colspan="2"><strong>Database 11g Release 2 (11.2)</strong></td>
</tr>
<tr>
<td>drs_start</td>
<td>Enables Oracle to determine whether or not the DRMON (Disaster Recovery Monitor) process should be started. </td>
</tr>
<tr>
<td>gc_files_to_locks</td>
<td>A RAC parameter that controls the mapping of pre-release 9.0.1 parallel cache management (PCM) locks to datafiles.</td>
</tr>
<tr>
<td>max_commit_propagation_delay</td>
<td>Used when data consistency between different RAC instances must be guaranteed and immediate i.e. if commits must be seen instantaneously on remote instances. </td>
</tr>
<tr>
<td>plsql_native_library_dir</td>
<td>Specifies the name of a directory where the shared objects produced by the native compiler are stored.</td>
</tr>
<tr>
<td>plsql_native_library_subdir_count</td>
<td>Specifies the number of subdirectories created by the database administrator in the directory specified by plsql_native_library_dir.
</td>
</tr>
<tr>
<td>sql_version</td>
<td>SQL language version parameter for compatibility issues.</td>
</tr>
</table>
]]></content:encoded>
			<wfw:commentRss>http://manchev.org/2011/12/initialization-parameter-changes-in-oracle-database-11g/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Software RAID and LVM configurations</title>
		<link>http://manchev.org/2011/11/software-raid-and-lvm-configurations/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=software-raid-and-lvm-configurations</link>
		<comments>http://manchev.org/2011/11/software-raid-and-lvm-configurations/#comments</comments>
		<pubDate>Fri, 25 Nov 2011 20:11:42 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[News]]></category>
		<category><![CDATA[linkedin]]></category>

		<guid isPermaLink="false">http://manchev.org/?p=606</guid>
		<description><![CDATA[I just wrote a followup to the LVM tutorial. This one shows basic steps for combining LVM and software RAID. Check it out here.]]></description>
			<content:encoded><![CDATA[<p>I just wrote a followup to the <a href="http://manchev.org/2011/11/introduction-to-logical-volume-manager/">LVM tutorial</a>. This one shows basic steps for combining LVM and software RAID. Check it out <a href="http://manchev.org/2011/11/adding-software-raid-to-lvm-configurations/">here</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://manchev.org/2011/11/software-raid-and-lvm-configurations/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Adding software RAID to LVM configurations</title>
		<link>http://manchev.org/2011/11/adding-software-raid-to-lvm-configurations/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=adding-software-raid-to-lvm-configurations</link>
		<comments>http://manchev.org/2011/11/adding-software-raid-to-lvm-configurations/#comments</comments>
		<pubDate>Fri, 25 Nov 2011 20:06:17 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Oracle Linux]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[lvm]]></category>
		<category><![CDATA[RAID]]></category>

		<guid isPermaLink="false">http://manchev.org/?p=574</guid>
		<description><![CDATA[In the previous tutorial on LVM we went through the steps on installing, configuring and managing the addition and removal of PV's. This article will move forward with the data protection options provided by LVM. Thinking about protection and disk &#8230;<p class="read-more"><a href="http://manchev.org/2011/11/adding-software-raid-to-lvm-configurations/">Read more &#187;</a></p>]]></description>
			<content:encoded><![CDATA[<p>In the <a href="http://manchev.org/2011/11/introduction-to-logical-volume-manager/">previous tutorial on LVM</a> we went through the steps on installing, configuring and managing  the addition and removal of PV's. This article will move forward with the data protection options provided by LVM. </p>
<p>Thinking about protection and disk drives, the first thing that comes to mind is RAID (Redundant Array of Inexpensive Disks). This technology provides redundancy by combining multiple disk drives and distributing data across. There are different ways of data distribution called "RAID levels" (1 to 6), as RAID 1 and RAID 5 being the most common.</p>
<p>In RAID 1 two or more drives keep mirrored copies of the data. No matter how many disk drives fail, if there is at least one operational drive, the whole information is accessible. This availability comes at a price of disk capacity.</p>
<p><a href="http://manchev.org/wp-content/uploads/2011/11/lvm-raid-1.png"><img src="http://manchev.org/wp-content/uploads/2011/11/lvm-raid-1.png" alt="" title="lvm-raid-1" width="200" height="259" class="aligncenter size-full wp-image-573" /></a></p>
<p>With RAID 5 the data is distributed over three disk drives at least. This configuration uses block-level striping with parity data distributed across all member disks. If any of the drives fails, the data is still available (the parity data is used to recover the missing information). The advantage of using RAID 5 is that the total capacity is not reduced by half (as with RAID 1). It is reduced only by the capacity of a single drive. For example if you have four 1 TB disk drives you can configure two RAID 1 arrays, each with a capacity of 1 TB. This makes a total of 2 TB of available disk capacity. If you configure a RAID 5 array instead, you will loose only 1 TB of capacity totaling in 3 TB of total storage being available.</p>
<p>This increased capacity, however, comes at a price of reduced availability. RAID 5 configurations can tolerate only a single drive failure. If two or more disk drives become unavailable, the entire array fails.</p>
<p><a href="http://manchev.org/wp-content/uploads/2011/11/lvm-raid-5.png"><img src="http://manchev.org/wp-content/uploads/2011/11/lvm-raid-5.png" alt="" title="lvm-raid-5" width="309" height="260" class="aligncenter size-full wp-image-572" /></a></p>
<p>To illustrate the usage of RAID within LVM we will change the LVM configuration that we built in the <a href="http://manchev.org/2011/11/introduction-to-logical-volume-manager/">previous tutorial</a>, adding RAID 1 protection to it.</p>
<p>We will put /dev/sdb1 and /dev/sdc1 in RAID 1 (mirroring without parity or striping) and mount it under /dev/md0. In a similar way we will combine /dev/sdd1 and /dev/sde1 and configure them to be accessible under /dev/md1.</p>
<p><a href="http://manchev.org/wp-content/uploads/2011/11/lvm-raid-configuration.png"><img src="http://manchev.org/wp-content/uploads/2011/11/lvm-raid-configuration.png" alt="" title="lvm-raid-configuration" width="500" height="187" class="aligncenter size-full wp-image-585" /></a></p>
<p>To build this configuration we will first evict all data from /dev/sdc1 and /dev/sde1. After that we will remove the /dev/sdc1 and /dev/sde1 partitions from the volume group. We will next create /dev/md0, but we will make it use a single disk for the moment (/dev/sdc1). We will create /dev/md1 in a similar fashion (using only /dev/sde1). We will then move away all data from /dev/sdb1 and /dev/sde1. After these two partitions are freed we will add them as mirrored disks to /dev/md0 and /dev/md1. This will let us build our RAID configurations step by step, without losing any data during the process.</p>
<p>Let's start by freeing /dev/sdc1. We use the <em>pvmove</em> command to evict its data.</p>
<pre>[root@el5 ~]# <strong>pvmove /dev/sdc1</strong>
  /dev/sdc1: Moved: 26.5%
  /dev/sdc1: Moved: 52.2%
  /dev/sdc1: Moved: 77.8%
  /dev/sdc1: Moved: 92.7%
  /dev/sdc1: Moved: 100.0%
[root@el5 ~]# </pre>
<p>Removing /dev/sdc1 from the <em>database</em> group is done via the <em>vgreduce</em> command.</p>
<pre>[root@el5 ~]# <em>vgreduce database /dev/sdc1</em>
  Removed "/dev/sdc1" from volume group "database"
[root@el5 ~]# </pre>
<p>Next we delete the physical volume by using <em>pvremove</em>.</p>
<pre>[root@el5 ~]# <em>pvremove /dev/sdc1</em>
  Labels on physical volume "/dev/sdc1" successfully wiped
[root@el5 ~]# </pre>
<p>Our next step should be to change the partition type for /dev/sdc1. Its type should be "fd" (Linux raid autodetect), if it is going to be used in a RAID configuration.</p>
<pre>[root@el5 ~]# <strong>fdisk /dev/sdc</strong>

The number of cylinders for this disk is set to 6527.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
   (e.g., DOS FDISK, OS/2 FDISK)

Command (m for help): <strong>t</strong>
Selected partition 1
Hex code (type L to list codes): <strong>fd</strong>
Changed system type of partition 1 to fd (Linux raid autodetect)

Command (m for help): <strong>w</strong>
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.
[root@el5 ~]# </pre>
<p>Building the RAID array is done via the <em>mdadm</em> command. The name is derived from Multiple Device (MD) and it is the main Linux command for managing RAID configurations.</p>
<pre>[root@el5 ~]# <strong>mdadm --create /dev/md0 --auto=yes -l 1 -n 2 /dev/sdc1 missing</strong>
mdadm: array /dev/md0 started.
[root@el5 ~]# </pre>
<p>After /dev/md0 is in place, we can build a physical volume on top of it.</p>
<pre>[root@el5 ~]# <strong>pvcreate /dev/md0</strong>
  Physical volume "/dev/md0" successfully created
[root@el5 ~]# </pre>
<p>After the PV is created we can extend the <em>database</em> group using <em>vgextend</em>.</p>
<pre>[root@el5 ~]# <strong>vgextend database /dev/md0 </strong>
  Volume group "database" successfully extended
[root@el5 ~]# </pre>
<p>Our RAID 1 configuration is using a single disk for the time being and it does not provide any level of protection. Let's move the data out of /dev/sdb1 and add it as a second device for /dev/md0.</p>
<p>Evicting the data is done by running the <em>pvmove</em> command.</p>
<pre>[root@el5 ~]# <strong>pvmove /dev/sdb1</strong>
  /dev/sdb1: Moved: 7.3%
  /dev/sdb1: Moved: 19.1%
  /dev/sdb1: Moved: 30.9%
  /dev/sdb1: Moved: 42.7%
  /dev/sdb1: Moved: 54.5%
  /dev/sdb1: Moved: 66.3%
  /dev/sdb1: Moved: 78.1%
  /dev/sdb1: Moved: 89.9%
  /dev/sdb1: Moved: 100.0%
[root@el5 ~]# </pre>
<p>Before changing the partition's type we have to take it out of the <em>database</em> group and remove the PV that is built on top of it.</p>
<pre>[root@el5 ~]# <strong>vgreduce database /dev/sdb1</strong>
  Removed "/dev/sdb1" from volume group "database"
[root@el5 ~]# <strong>pvremove /dev/sdb1</strong>
  Labels on physical volume "/dev/sdb1" successfully wiped
[root@el5 ~]# </pre>
<p>We can now safely change the partition type to "fd".</p>
<pre>[root@el5 ~]# <strong>fdisk /dev/sdb</strong>

The number of cylinders for this disk is set to 6527.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
   (e.g., DOS FDISK, OS/2 FDISK)

Command (m for help): <strong>t</strong>
Selected partition 1
Hex code (type L to list codes): <strong>fd</strong>
Changed system type of partition 1 to fd (Linux raid autodetect)

Command (m for help): <strong>w</strong>
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.
[root@el5 ~]# </pre>
<p>Adding /dev/sdb1 to /dev/md0 is done by running <em>mdadm</em>.</p>
<pre>[root@el5 ~]# <strong>mdadm --manage /dev/md0 --add /dev/sdb1</strong>
mdadm: added /dev/sdb1
[root@el5 ~]# </pre>
<p>Executing the <em>mdam</em> command starts a synchronization process. Its task is to mirror the data from /dev/sdc1 to /dev/sdb1. We can check the process's progress by looking at /proc/mdstat.</p>
<pre>[root@el5 ~]# <strong>cat /proc/mdstat</strong>
Personalities : [raid1]
md0 : active raid1 sdb1[2] sdc1[0]
      52428032 blocks [2/1] [U_]
      [>....................]  recovery =  3.0% (1600000/52428032) finish=3.7min speed=228571K/sec

unused devices: <none>
[root@el5 ~]</pre>
<p>The synchronization process mirrored about 3% of the data so far. When it completes, the output  from /proc/mdstat will look like this.</p>
<pre>[root@el5 ~]# <strong>cat /proc/mdstat</strong>
Personalities : [raid1]
md0 : active raid1 sdb1[1] sdc1[0]
      52428032 blocks [2/2] [UU]

unused devices: <none>
[root@el5 ~]# </pre>
<p>Our first RAID 1 configuration /dev/md0 is now operational. Let's move on with building the second one - /dev/md1.</p>
<p>We start by evicting the data from /dev/sde1</p>
<pre>[root@el5 ~]# <strong>pvmove /dev/sde1</strong>
  /dev/sde1: M	oved: 6.0%
  /dev/sde1: Moved: 17.8%
  /dev/sde1: Moved: 29.6%
  /dev/sde1: Moved: 41.4%
  /dev/sde1: Moved: 53.2%
  /dev/sde1: Moved: 65.0%
  /dev/sde1: Moved: 76.8%
  /dev/sde1: Moved: 88.6%
  /dev/sde1: Moved: 100.0%
[root@el5 ~]# </pre>
<p>Next we take /dev/sde1 out of the group and remove the PV.</p>
<pre>[root@el5 ~]# <strong>vgreduce database /dev/sde1</strong>
  Removed "/dev/sde1" from volume group "database"
[root@el5 ~]# <strong>pvremove /dev/sde1</strong>
  Labels on physical volume "/dev/sde1" successfully wiped
[root@el5 ~]# </pre>
<p>Changing the partition type to "fd" is done via fdisk.</p>
<pre>[root@el5 ~]# <strong>fdisk /dev/sde</strong>

The number of cylinders for this disk is set to 6527.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
   (e.g., DOS FDISK, OS/2 FDISK)

Command (m for help): <strong>t</strong>
Selected partition 1
Hex code (type L to list codes): <strong>fd</strong>
Changed system type of partition 1 to fd (Linux raid autodetect)

Command (m for help): <strong>w</strong>
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.
[root@el5 ~]# </pre>
<p>As with /dev/md0 we build the /dev/md1 RAID configuration with /dev/sde1 and a missing second disk.</p>
<pre>[root@el5 ~]# <strong>mdadm --create /dev/md1 --auto=yes -l 1 -n 2 /dev/sde1 missing</strong>
mdadm: array /dev/md1 started.
[root@el5 ~]# </pre>
<p>We create a PV on top of /dev/md1 and extend the <em>database</em> group with it.</p>
<pre>[root@el5 ~]# <strong>pvcreate /dev/md1</strong>
  Physical volume "/dev/md1" successfully created
[root@el5 ~]# <strong>vgextend database /dev/md1</strong>
  Volume group "database" successfully extended
[root@el5 ~]# </pre>
<p>Let's inspect the PV's, just to be sure that everything is correct.</p>
<pre>[root@el5 ~]# <strong>pvdisplay</strong>
  --- Physical volume ---
  PV Name               /dev/sdd1
  VG Name               database
  PV Size               50.00 GB / not usable 3.31 MB
  Allocatable           yes
  PE Size (KByte)       4096
  Total PE              12799
  Free PE               5119
  Allocated PE          7680
  PV UUID               RF37f3-SfBR-aozU-7l01-Rqh9-4YV2-1o7GdK

  --- Physical volume ---
  PV Name               /dev/md0
  VG Name               database
  PV Size               50.00 GB / not usable 3.25 MB
  Allocatable           yes
  PE Size (KByte)       4096
  Total PE              12799
  Free PE               7679
  Allocated PE          5120
  PV UUID               PAEniI-bCth-w430-3gsV-ToeS-JARL-wsJ2g6

  --- Physical volume ---
  PV Name               /dev/md1
  VG Name               database
  PV Size               50.00 GB / not usable 3.25 MB
  Allocatable           yes
  PE Size (KByte)       4096
  Total PE              12799
  Free PE               12799
  Allocated PE          0
  PV UUID               I9Hrbo-ehjq-vn9b-PgNa-PhAY-57tj-j8f8Vx

[root@el5 ~]# </pre>
<p>Our final tasks is to move the data out of /dev/sdd1 and add it as a second disk for /dev/md1.</p>
<pre>[root@el5 ~]# <strong>pvmove /dev/sdd1</strong>
  /dev/sde1: M	oved: 6.0%
  /dev/sde1: Moved: 17.8%
  /dev/sde1: Moved: 29.6%
  /dev/sde1: Moved: 41.4%
  /dev/sde1: Moved: 53.2%
  /dev/sde1: Moved: 65.0%
  /dev/sde1: Moved: 76.8%
  /dev/sde1: Moved: 88.6%
  /dev/sde1: Moved: 100.0%
[root@el5 ~]# <strong>vgreduce database /dev/sdd1</strong>
  Removed "/dev/sdd1" from volume group "database"
[root@el5 ~]# <strong>pvremove /dev/sdd1</strong>
  Labels on physical volume "/dev/sdd1" successfully wiped
[root@el5 ~]# </pre>
<p>We change the partition type to Linux raid autodetect (fd).</p>
<pre>[root@el5 ~]# <strong>fdisk /dev/sdd</strong>

The number of cylinders for this disk is set to 6527.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
   (e.g., DOS FDISK, OS/2 FDISK)

Command (m for help): <strong>t</strong>
Selected partition 1
Hex code (type L to list codes): <strong>fd</strong>
Changed system type of partition 1 to fd (Linux raid autodetect)

Command (m for help): <strong>w</strong>
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.
[root@el5 ~]# </pre>
<p>Adding /dev/sdd1 to /dev/md1 is done via <em>mdadm</em>.</p>
<pre>[root@el5 ~]# <strong>mdadm --manage /dev/md1 --add /dev/sdd1</strong>
mdadm: added /dev/sdd1</pre>
<p>This starts the mirroring process that we already saw for /dev/md0.</p>
<pre>[root@el5 ~]# <strong>cat /proc/mdstat</strong>
Personalities : [raid1]
md1 : active raid1 sdd1[2] sde1[0]
      52428032 blocks [2/1] [U_]
      [=>...................]  recovery =  5.3% (2800000/52428032) finish=3.8min speed=215384K/sec

md0 : active raid1 sdb1[1] sdc1[0]
      52428032 blocks [2/2] [UU]

unused devices: <none>
[root@el5 ~]# </pre>
<p>When the process completes we will notice that /proc/mdstat shows two RAID 1 groups (md0 and md1).</p>
<pre>[root@el5 ~]# <strong>cat /proc/mdstat</strong>
Personalities : [raid1]
md1 : active raid1 sdd1[1] sde1[0]
      52428032 blocks [2/2] [UU]

md0 : active raid1 sdb1[1] sdc1[0]
      52428032 blocks [2/2] [UU]

unused devices: <none>
[root@el5 ~]# </pre>
<p>Looking at the information about our physical volumes we can notice that from LVM's perspective there are only two PV's - /dev/md0 and /dev/md1.</p>
<pre>[root@el5 ~]# <strong>pvdisplay</strong>
  --- Physical volume ---
  PV Name               /dev/md0
  VG Name               database
  PV Size               50.00 GB / not usable 3.25 MB
  Allocatable           yes
  PE Size (KByte)       4096
  Total PE              12799
  Free PE               7679
  Allocated PE          5120
  PV UUID               PAEniI-bCth-w430-3gsV-ToeS-JARL-wsJ2g6

  --- Physical volume ---
  PV Name               /dev/md1
  VG Name               database
  PV Size               50.00 GB / not usable 3.25 MB
  Allocatable           yes
  PE Size (KByte)       4096
  Total PE              12799
  Free PE               5119
  Allocated PE          7680
  PV UUID               I9Hrbo-ehjq-vn9b-PgNa-PhAY-57tj-j8f8Vx

[root@el5 ~]# </pre>
<p>Let's take a look at the <em>database</em> group as well.</p>
<pre>[root@el5 ~]# <strong>vgdisplay</strong>
  --- Volume group ---
  VG Name               database
  System ID
  Format                lvm2
  Metadata Areas        2
  Metadata Sequence No  31
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                2
  Open LV               2
  Max PV                0
  Cur PV                2
  Act PV                2
  VG Size               99.99 GB
  PE Size               4.00 MB
  Total PE              25598
  Alloc PE / Size       12800 / 50.00 GB
  Free  PE / Size       12798 / 49.99 GB
  VG UUID               DcuO3X-HFRV-ZVyx-MVlD-gY3c-jyo0-FwR3uO

[root@el5 ~]# </pre>
<p>The group consists of two PV's and its capacity is reduced to 100 GB. This is the price we have to pay for having mirrored copies of each of the volumes.</p>
<p>You probably noticed that all changes that we did for configuring the RAID groups were accomplished with mounted devices. This is one of the key advantages provided by LVM - the ability to manipulate physical disks without disrupting the system's availability.</p>
<p><strong>Increasing the RAID's capacity</strong></p>
<p>The available free space always depletes, sooner or later. There are two ways for increasing the capacity for a RAID configuration like the one we built. The first approach is to add more physical disks of the same size. The md0 group for instance consists of two drives, 50 GB each, and provides a total of 50 GB of disk space. If add two more 50 GB disks, we will increase the group's capacity to 100 GB (4x50 GB divided by two, because of the mirroring).</p>
<p>Another approach would be to take out a single disk from md0 and md1 and replace them with disks, having bigger capacity. We can then use these new disks and built a third, bigger RAID 1 group (md2). We can then move all data from md0 and md1 to the newly created md2 group. After no data is left in the old RAID 1 groups, we can destroy them, replace the remaining two disks with bigger ones and built another RAID 1 group. At the end we will have two RAID 1 groups again, but they will have much bigger capacity, as they will use bigger disk drives.</p>
<p>We are already familiar with the process of adding new disks for increasing the capacity, so there is nothing new for us in the first approach. It will be more interesting to see how we can implement the second approach, changing the current drives with bigger ones.</p>
<p>Let's start by inspecting the PV's that are in use (we have two RAID 1 groups at the moment).</p>
<pre>[root@el5 ~]# <strong>pvdisplay</strong>
  --- Physical volume ---
  PV Name               /dev/md0
  VG Name               database
  PV Size               50.00 GB / not usable 3.06 MB
  Allocatable           yes
  PE Size (KByte)       4096
  Total PE              12799
  Free PE               7679
  Allocated PE          5120
  PV UUID               PAEniI-bCth-w430-3gsV-ToeS-JARL-wsJ2g6

  --- Physical volume ---
  PV Name               /dev/md1
  VG Name               database
  PV Size               50.00 GB / not usable 3.06 MB
  Allocatable           yes
  PE Size (KByte)       4096
  Total PE              12799
  Free PE               5119
  Allocated PE          7680
  PV UUID               I9Hrbo-ehjq-vn9b-PgNa-PhAY-57tj-j8f8Vx

[root@el5 ~]# </pre>
<p>Let's remove the second and the fourth disks of the machine. We have to mark /dev/sdb1 and /dev/sdd1 as failed and remove them from their RAID groups (md0 and md1).</p>
<pre>[root@el5 ~]# <strong>mdadm --manage /dev/md0 --fail /dev/sdb1</strong>
mdadm: set /dev/sdb1 faulty in /dev/md0
[root@el5 ~]# <strong>mdadm --manage /dev/md0 --remove /dev/sdb1</strong>
mdadm: hot removed /dev/sdb1
[root@el5 ~]# <strong>mdadm --manage /dev/md1 --fail /dev/sdd1</strong>
mdadm: set /dev/sdd1 faulty in /dev/md1
[root@el5 ~]# <strong>mdadm --manage /dev/md1 --remove /dev/sdd1</strong>
mdadm: hot removed /dev/sdd1
[root@el5 ~]# </pre>
<p>We turn of the virtual machine, remove the disks and replace them with two new drives, 200 GB each. After the change is completed, the VM's configuration looks like this:</p>
<p><a href="http://manchev.org/wp-content/uploads/2011/11/lvm-raid-diskadd.jpg"><img src="http://manchev.org/wp-content/uploads/2011/11/lvm-raid-diskadd.jpg" alt="" title="lvm-raid-diskadd" width="485" height="253" class="aligncenter size-full wp-image-590" /></a></p>
<p>Our first task after the system comes up is to build "fd" partitions on the two new disks (/dev/sdb and /dev/sdd).</p>
<pre>[root@el5 ~]# <strong>fdisk /dev/sdb</strong>
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel. Changes will remain in memory only,
until you decide to write them. After that, of course, the previous
content won't be recoverable.

The number of cylinders for this disk is set to 26108.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
   (e.g., DOS FDISK, OS/2 FDISK)
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)

Command (m for help): <strong>n</strong>
Command action
   e   extended
   p   primary partition (1-4)
p
Partition number (1-4): <strong>1</strong>
First cylinder (1-26108, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-26108, default 26108):
Using default value 26108

Command (m for help): <strong>t</strong>
Selected partition 1
Hex code (type L to list codes): <strong>fd</strong>
Changed system type of partition 1 to fd (Linux raid autodetect)

Command (m for help): <strong>w</strong>
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.
[root@el5 ~]# <strong>fdisk /dev/sdd</strong>
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel. Changes will remain in memory only,
until you decide to write them. After that, of course, the previous
content won't be recoverable.

The number of cylinders for this disk is set to 26108.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
   (e.g., DOS FDISK, OS/2 FDISK)
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)

Command (m for help): <strong>n</strong>
Command action
   e   extended
   p   primary partition (1-4)
p
Partition number (1-4): <strong>1</strong>
First cylinder (1-26108, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-26108, default 26108):
Using default value 26108

Command (m for help): <strong>t</strong>
Selected partition 1
Hex code (type L to list codes): <strong>fd</strong>
Changed system type of partition 1 to fd (Linux raid autodetect)

Command (m for help): <strong>w</strong>
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.
[root@el5 ~]# </pre>
<p>Next, we use <em>mdadm</em> to build the third RAID 1 group (md2). This time there will be no missing disks in the initial setup.</p>
<pre>[root@el5 ~]# <strong>mdadm --create /dev/md2 --auto=yes -l 1 -n 2 /dev/sdb1 /dev/sdd1</strong>
mdadm: array /dev/md2 started.
[root@el5 ~]# </pre>
<p>Looking at /proc/mdstat will show us the three RAID groups.</p>
<pre>[root@el5 ~]# <strong>cat /proc/mdstat</strong>
Personalities : [raid1]
md2 : active raid1 sdd1[1] sdb1[0]
      209712384 blocks [2/2] [UU]

md1 : active raid1 sde1[0]
      52428032 blocks [2/1] [U_]

md0 : active raid1 sdc1[0]
      52428032 blocks [2/1] [U_]

unused devices: <none>
[root@el5 ~]# </pre>
<p>Moving the data from md0 to md2 is done by running <i>pvmove</i>.</p>
<pre>[root@el5 ~]# <strong>pvmove /dev/md0 /dev/md2</strong>
  /dev/md0: Moved: 10.3%
  /dev/md0: Moved: 20.6%
  /dev/md0: Moved: 30.9%
  /dev/md0: Moved: 41.5%
  /dev/md0: Moved: 51.9%
  /dev/md0: Moved: 61.7%
  /dev/md0: Moved: 72.2%
  /dev/md0: Moved: 82.7%
  /dev/md0: Moved: 93.1%
  /dev/md0: Moved: 100.0%
[root@el5 ~]# </pre>
<p>We do the same for md1.</p>
<pre>[root@el5 ~]# <strong>pvmove /dev/md1 /dev/md2</strong>
  /dev/md1: Moved: 3.5%
  /dev/md1: Moved: 21.0%
  /dev/md1: Moved: 35.0%
  /dev/md1: Moved: 45.5%
  /dev/md1: Moved: 59.4%
  /dev/md1: Moved: 73.3%
  /dev/md1: Moved: 87.2%
  /dev/md1: Moved: 100.0%
[root@el5 ~]# </pre>
<p>After md0 and md1 are freed, we can safely remove them from the <i>database</i> group. This is done by running <i>vgreduce</i>.</p>
<pre>[root@el5 ~]# <strong>vgreduce database /dev/md0</strong>
  Removed "/dev/md0" from volume group "database"
[root@el5 ~]# <strong>vgreduce database /dev/md1</strong>
  Removed "/dev/md1" from volume group "database"
[root@el5 ~]# </pre>
<p>Let's remove the PV's as well.</p>
<pre>[root@el5 ~]# <strong>pvremove /dev/md0</strong>
  Labels on physical volume "/dev/md0" successfully wiped
[root@el5 ~]# <strong>pvremove /dev/md1</strong>
  Labels on physical volume "/dev/md1" successfully wiped
[root@el5 ~]# </pre>
<p>If we run <strong>pvdisplay</strong>, we will see that the only available physical volume is the newly created /dev/md2 and that its capacity totals to 200 GB.</p>
<pre>[root@el5 ~]# <strong>pvdisplay</strong>
  --- Physical volume ---
  PV Name               /dev/md2
  VG Name               database
  PV Size               200.00 GB / not usable 1.25 MB
  Allocatable           yes
  PE Size (KByte)       4096
  Total PE              51199
  Free PE               38399
  Allocated PE          12800
  PV UUID               hmTRBJ-gjMJ-Dqnm-QhFL-6187-Zhby-vHL9ko

[root@el5 ~]# </pre>
<p>This is also the only physical volume used by the <i>database</i> group.</p>
<pre>[root@el5 ~]# <strong>vgdisplay</strong>
  --- Volume group ---
  VG Name               database
  System ID
  Format                lvm2
  Metadata Areas        1
  Metadata Sequence No  44
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                2
  Open LV               2
  Max PV                0
  Cur PV                1
  Act PV                1
  VG Size               200.00 GB
  PE Size               4.00 MB
  Total PE              51199
  Alloc PE / Size       12800 / 50.00 GB
  Free  PE / Size       38399 / 150.00 GB
  VG UUID               DcuO3X-HFRV-ZVyx-MVlD-gY3c-jyo0-FwR3uO

[root@el5 ~]# </pre>
<p>We just have to remove /dev/md0 and /dev/md1. After that we should replace the two remaining disks with 200 GB ones. We can then build a new RAID 1 group and extend <i>database</i> with it. Performing these steps should already be trivial for you, so let's finish this tutorial here.</p>
]]></content:encoded>
			<wfw:commentRss>http://manchev.org/2011/11/adding-software-raid-to-lvm-configurations/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Oracle Database Upgrade to 11gR2</title>
		<link>http://manchev.org/2011/11/oracle-database-upgrade-to-11gr2/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=oracle-database-upgrade-to-11gr2</link>
		<comments>http://manchev.org/2011/11/oracle-database-upgrade-to-11gr2/#comments</comments>
		<pubDate>Wed, 23 Nov 2011 12:55:59 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[News]]></category>

		<guid isPermaLink="false">http://manchev.org/?p=570</guid>
		<description><![CDATA[Oracle is delivering an one hour, free webcast on upgrading to 11gR2. The webcast is scheduled for November 30 at 9:00 AM CET. More details are available at oracle.com.]]></description>
			<content:encoded><![CDATA[<p>Oracle is delivering an one hour, free webcast on upgrading to 11gR2. The webcast is scheduled for November 30 at 9:00 AM CET. More details are available at <a href="http://www.oracle.com/webapps/events/ns/EventsDetail.jsp?p_eventId=144968&#038;src=7330243&#038;src=7330243&#038;Act=7">oracle.com</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://manchev.org/2011/11/oracle-database-upgrade-to-11gr2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Building defensive perimeter with Oracle Database Firewall</title>
		<link>http://manchev.org/2011/11/building-defensive-perimeter-with-oracle-database-firewall/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=building-defensive-perimeter-with-oracle-database-firewall</link>
		<comments>http://manchev.org/2011/11/building-defensive-perimeter-with-oracle-database-firewall/#comments</comments>
		<pubDate>Sat, 19 Nov 2011 21:08:37 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[News]]></category>

		<guid isPermaLink="false">http://manchev.org/?p=567</guid>
		<description><![CDATA[The autumn BGOUG conference is officially over. You can find the slides from my session here: session]]></description>
			<content:encoded><![CDATA[<p>The autumn BGOUG conference is officially over. You can find the slides from my session here: <a href="http://manchev.org/wp-content/uploads/2011/11/bgoug_dbfw.pdf" title="Building defensive perimeter with Oracle Database Firewall"></a><br />
session </p>
]]></content:encoded>
			<wfw:commentRss>http://manchev.org/2011/11/building-defensive-perimeter-with-oracle-database-firewall/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

