How to move a datafile from a ASM disk group to another
2/27/2012 07:16:00 PM
Gönderen Mete Karar
I'll explain two ways of moving a datafile from a ASM disk group to another disk group. As you might guess, during migration of the data file you need to take whether the whole tablespace or just the the datafile offline, which makes the difference between two approaches I'm about to explain.
Here is the first way:
1. Find the name of the datafile that you're going to migrate:
SQL> SELECT FILE_NAME FROM DBA_DATA_FILES WHERE tablespace_name = 'EXAMPLE';
2. Take the tablespace offline:
SQL> alter tablespace example offline;
3. Copy the file using RMAN:
RMAN> COPY datafile '+RECOVERY/orcl/datafile/example.123.123456789' to '+DATA';
4. Change datafile's name to the name displayed as output of the command above:
SQL> ALTER DATABASE RENAME FILE '<old_name>' TO '<output file name written at rman output>';
5. Bring back the tablespace online:
And here is the second way:
1. Find the name of the datafile that you're going to migrate just like firt method:
2. Take the datafile offline instead this time:
3. Copy the file using RMAN:
4. Change datafile's name to the new name displayed as output of the command above to update data dictionary:
5. Rename the datafile using RMAN to update ASM. This command is equivalent of "alter database rename file":
6. Recover the new datafile:
7. Bring it online
Both ways do the job. To choose between them is deciding whether tablespace can be taken offline for while or not.
How to Install/Update Java (JDK) on Oracle Linux
2/22/2012 10:12:00 AM
Gönderen Mete Karar
1. Download JDK RPM from Oracle
2. As root:
$ chmod +x jdk-6u30-linux-i586-rpm.bin
$ ./jdk-6u30-linux-i586-rpm.bin.
3. Re-link to new JDK:
$ /usr/sbin/alternatives --install /usr/bin/java java /usr/java/jdk1.6.0_30/bin/java 16030
or alternatively:
Deinstalling Old Oracle Homes After Upgrade
2/16/2012 06:17:00 PM
Gönderen Mete Karar
When Oracle Database and Grid Infrastructure (GI) is updated as Oracle recommended which is out-of-place upgrade, a new Oracle home is created. And a new home means extra disk space. Since no disk has unlimited capacity after a few or many upgrades you need to clean up.
So, assuming we are performing clean up on a single instance with ASM configured and homes to be uninstalled is under /u01/app/oracle/product/11.2.0 let's start with db home:
Deinstall script discovers the configuration. Notice that no database names that are configured in this Oracle home is found. Accept default answers and say yes to continue:
Inventory Location where the Oracle home registered is: /u01/app/oraInventory
No Enterprise Manager configuration to be updated for any database(s)
No Enterprise Manager ASM targets to update
No Enterprise Manager listener targets to migrate
Checking the config status for CCR
Oracle Home exists with CCR directory, but CCR is not configured
CCR check is finished
Do you want to continue (y - yes, n - no)? [n]: y
Deinstall tool does the cleanup smoothly.
Next step is uninstalling GI home which is a bit more tricky. According to Oracle documentation you need to change the permissions of the directory first as root:
GI also has deinstall tool in its home. However if you run it as you do for database, you see the following error though no error logged in the log file.
Don't give up deinstall tool yet. Unzip the 7th of the installation zip files you've downloaded which is the deinstall tool and run it from the unzip directory by giving the home parameter:
The cluster node(s) on which the Oracle home de-installation will be performed are:null
Oracle Home selected for de-install is: /u01/app/oracle/product/11.2.0/grid
Inventory Location where the Oracle home registered is: /u01/app/oraInventory
Skipping Windows and .NET products configuration check
The home being deconfigured is NOT a configured Grid Infrastructure home (/u01/app/oracle/product/11.2.0.2/grid)
ASM was not detected in the Oracle Home
Do you want to continue (y - yes, n - no)? [n]: y
Again say yes to cleanup. When it finishes, you gain ~10GB of your disk space back.
Upgrading Single Instance Oracle Database 11.2.0.1 to 11.2.0.2
2/15/2012 05:25:00 PM
Gönderen Mete Karar
Today I'll upgrade my single instance database from 11.2.0.1 to 11.2.0.2. As you know patch sets are full installations so procedure will be like installing for the very first time except choosing upgrade options.
My database takes advantage of ASM. Therefore we'll start with upgrading Grid Infrastructure. Unzip the 3. of the installation zip files to an appropriate directory such as /tmp. Since 11gR2, upgrades must be done as "out-of-place upgrades". So create the directories for grid and database upgrades.
If you don't show an empty home to installer you get the following error:
I will use graphical interfaces. To use UI, you can take a look at my blog about displaying x client on Oracle Linux. Run the installer:
Select upgrade option.
Select language(s)
Leave groups as default
Select the new directory as software location. After prerequisite check (nothing came up hopefully) installation will begin and you will be prompted to run root script:
Grid Infrastructure upgrade is completed when the script is finished. You can check the new version by:
Next step is upgrading the database. Unzip the first and the second of the installation zip files and run the installer.
Skip software updates.
Select upgrade option.
Select language(s)
Select the edition you want to install.
Select the new directory as software location.
Leave groups as default
After prerequisite check (nothing came up hopefully) installation will begin and you will be prompted to run root script:
Output of the root script should be like the following:
When you click "OK" when the script succeeds, Database Upgrade Assistant (DBUA) automatically starts.
Select the database to upgrade.
If Oracle finds out any warnings, you are prompted to correct them. You can run the recommended commands as fix and keep going.
Select an appropriate number of parallelism and turn off archiving otherwise some amount of redo log will be generated.
You don't want to move database files so leave as default
Select ASM disk group for FRA if not discovered
A summary report is generated.
Upgrade process when you click on finish.
Upgrade may take quite some while depend on your configuration.
At the end a result report is generated.
The whole procedure is pretty much straight forward and goes smoothly.
How to change password of users sysman and dbsnmp for DB Console
2/13/2012 06:28:00 PM
Gönderen Mete Karar
For security reasons or you just forget about password expiration and users got locked, you may need to change passwords of users: sysman and dbsnmp. It is not as easy as changing as user's password, but it's so hard either. Here are the steps:
1. Logon to your server as software owner, probably oracle
2. If ORACLE_UNQNAME is not set properly:
3. Stop DB Console
4. Open SQLPlus as sysdba
SQL> conn / as sysdba
SQL> alter user sysman identified by new_password;
SQL> alter user dbsnmp identified by new_password;
If user(s) got locked:
SQL> alter user sysman account unlock;
SQL> alter user dbsnmp account unlock;
5. To change sysman's password for DB Console edit config file:
If it is a RAC environment
$ cd /u01/app/oracle/product/11.2.0/dbhome_1/<node_name>_<db_name>/sysman/config/
If it is a single instance:
Open emoms.properties file with your favorite text editor and change the lines:
orcle.sysman.eml.mntr.emdRepPwd=newplaintextpassword
orcle.sysman.eml.mntr.emdRepPwdEncrypted=FALSE (Change it from TRUE to FALSE)
Don't worry because of writing password in plain text to a file, all the password you've written down will be encrypted and the property emdRepPwdEncrypted will turn into TRUE again when you start DB Console.
6. To change DBSNMP's password:
If it is a RAC environment
If it is a single instance:
Edit targets.xml file for every appearance of statement below, except the one for ASM.
Change encrypted from TRUE to FALSE
<property name="password" value="new_password" encrypted="FALSE">
It's the same case for plain text and encryption just like previous step.
7. Start DB Console:
8. You can check the files you edited to see passwords got encrypted.
Backing up Exadata Storage Cell
2/09/2012 04:59:00 PM
Gönderen Mete Karar
$ imageinfo
Kernel version: 2.6.18-194.3.1.0.4.el5 #1 SMP Sat Feb 19 03:38:37 EST 2011 x86_64
Cell version: OSS_11.2.0.3.0_LINUX.X64_110520
Cell rpm version: cell-11.2.2.3.2_LINUX.X64_110520-1
Active image version: 11.2.2.3.2.110520
Active image activated: 2011-06-24 00:04:28 -0700
Active image status: success
Active system partition on device: /dev/md5
Active software partition on device: /dev/md7
In partition rollback: Impossible
Cell boot usb partition: /dev/sdm1
Cell boot usb version: 11.2.2.3.2.110520
Inactive image version: undefined
Rollback to the inactive partitions: Impossible
What is left for you to back up is just a couple files listed below:
1. /etc/hosts
2. /etc/modprobe.conf
3. /etc/sysconfig/network
4. /etc/sysconfig/network-scripts/*
Exadata turns your USB disk into a bootable disk of active image of your system.
How to Display X Client on Oracle Linux to Run DBCA
2/08/2012 06:09:00 PM
Gönderen Mete Karar
As a best practice, Oracle recommends creating new databases by using atabase Configuration Assistant (DBCA) tool. Since DBCA is a graphical interface and if your Oracle runs on an Oracle Linux installation without a desktop environment what you need to do is explained right below:
1. Install Xming on your Windows desktop. During the installation select the "Don't install an SSH Client" radio button.
2. Run Xming
3. Assuming that you're using Putty, click "Enable X11 forwarding" and set "X Display Location" to "localhost:0" as displayed below:
After you logged on to your server you can run DBCA and a new window will be opened on your desktop.
RMAN-03009 and ORA-00245 on 11g R2 RAC
2/07/2012 01:52:00 PM
Gönderen Mete Karar
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03009: failure of backup command on x channel at <sometime>
exit;
ORA-00245: control file backup operation failed