Friday, October 30, 2015

Moving Tables to new TableSpace.

Task: There was a requirement to move some tables to SSD disk which is on ASM

So the tasks carried out was

Created ASM  DISK Group  INDEX ASM.

Created  a tablespace  called DATA_SSD using EM

Then moved required tables to newly created tablespace.


Alter table table_name move tablespace new_tablespace;

Alter table EMPLOYEE move tablespace DATA_SSD;

After Creating this   It's required  to Rebuild Indexes

Alter index index_name rebuild tablespace new_tablespace;

Alter index EMPNO_IDX rebuild tablespace DATA_SSD;

Tuesday, October 20, 2015

DB Auto Start Auto Shutdown on AIX 7.1 Server

I installed oracle database 11.2.0.4 on  AIX 7.1 server .Then it was required to start the db server, listener and dbconsole when  server is starting  and stop all services when shutting down the server.

I carried out following steps

1)Edit /etc/oratab entry

vi /etc/orataba

LECOBILL:/u02/app/oracle/product/11.2.0/dbhome_1 :Y


2) create a file called /etc/dboracle


vi /etc/dboracle

#! /bin/sh -x
#
# Change the value of ORACLE_HOME to specify the correct Oracle home
# directory for your installation.
ORACLE_HOME=/u02/app/oracle/product/11.2.0/dbhome_1
#
# Change the value of ORACLE to the login name of the
# oracle owner at your site.
#
ORACLE=oracle
ORACLE_SID=LECOBILL
PATH=${PATH}:$ORACLE_HOME/bin
HOST=`hostname`
PLATFORM=`uname`
export ORACLE_HOME ORACLE_SID PATH
case $1 in
'start')
# Listener and instance are started by 'dbstart'
su - $ORACLE $ORACLE_HOME/bin/dbstart $ORACLE_HOME >> /var/log/oracle 2>&1 &
;;
'stop')
su - $ORACLE $ORACLE_HOME/bin/emctl stop dbconsole >> /var/log/oracle
# Listener and instance are shut down by 'dbstart'
su - $ORACLE $ORACLE_HOME/bin/dbshut $ORACLE_HOME >> /var/log/oracle 2>&1 &
;;
*)
echo "usage: $0 {start|stop}"
exit
;;
esac
#
exit


3).change  the group and permission for /etc/dboracle file

# chgrp dba /etc/dboracle
# chmod 750 /etc/dboracle

4).Then create symbolic links to /etc/dboracle  with appropriate  run levels
    Here I am in multi user environment.

# ln -s /etc/dboracle /etc/rc.d/rc2.d/S99dbora
# ln -s /etc/dboracle /etc/rc.d/rc2.d/K01dbora

5).Reboot the Machine to check
# shutdown -Fr