Tuesday, March 26, 2013

Add database to 11g OEM Grid control


Here I have a 11g Grid control running on Linux x86_64.

To add a database in the Grid control, Open OEM grid control page --> targets --> databases
 Click on ADD button, then the below screenshot will appear






Select the hostname from the list shown and click continue.
NOTE : The hostnames are displayed when that server is configured with the GRID server, if not configure.

 It will take some time to find and display the targets and the  listeners found on that host(server).
Select the target you want to add and the listener associated with it. Then click on configure button for the selected target and you’ll get below screen.




Give ‘dbsnmp’ password and fill all the fields correctly then click next and ok.



Done, now you’ll see your target(database) in the OEM grid database list. Njoy !!!!!!


Thursday, March 21, 2013

Move datafile to NEW Location


SQL> select * from v$version;

BANNER
--------------------------------------------------------------------------------
Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production
PL/SQL Release 11.2.0.2.0 - Production
CORE    11.2.0.2.0      Production
TNS for Linux: Version 11.2.0.2.0 - Production
NLSRTL Version 11.2.0.2.0 - Production

SQL>
SQL> select name from v$datafile;

NAME
--------------------------------------------------------------------------------
/opt/oracle/data/DEV3/system01.dbf
/opt/oracle/data/DEV3/sysaux01.dbf
/opt/oracle/data/TEST01.dbf

Here my TEST tablespace datafile is not in DEV3 location, so I wanted to move into /DEV location.
Here I’m testing in my DEV database but make sure no one using this tablespace if this is doing in prod database J

1)      Make the corresponding Tablespace OFFLINE

        SQL> ALTER tablespace TEST offline;
                  Tablespace altered.

2)      Update the data dictionary pointing to new location using below command:

         SQL> ALTER DATABASE RENAME FILE  '/opt/oracle/data/TEST01.dbf'  to    '/opt/oracle/data/DEV3/TEST01.dbf';
                 Database altered.

3)      Now, recover the datafile from new location:

         SQL> RECOVER DATAFILE '/opt/oracle/data/DEV3/TEST01.dbf';
                   Media recovery complete.

4)      Bring back the TEST tablespace ONLINE

         SQL>  ALTER tablespace TEST online;
                   Tablespace altered.


SQL> select name from v$datafile;

NAME
--------------------------------------------------------------------------------
/opt/oracle/data/DEV3/system01.dbf
/opt/oracle/data/DEV3/sysaux01.dbf
/opt/oracle/data/DEV3/TEST01.dbf

Now my TEST datafile moved to the new location.

Auto Scroll Stop Scroll