A Oracle DBA's BLOG

Welcome to my ORACLE DBA blog. You will be Amazing!!!

Thursday, March 29, 2012

Oracle Enterprise Manager (OEM) 11g Start/Stop

Starting and Stopping the Oracle Enterprise Manager (OEM)

 Oracle Enterprise Management is Web-Based tool to manage Oracle Database.OEM using for perform administrative task abd view performance statistics. 


How to use Database Control
a) ORACLE_HOME/bin/emctl start dbconsole  [To start DB Control]
b) ORACLE_HOME/bin/emctl status dbconsole [To check status of DB Control]
c) ORACLE_HOME/bin/emctl stop dbconsole   [To stop DB Control]

If you didnt install OEM through installation Oracle Database 11g Then You need downloand OEL and installa it by your self.
So,i will write a article about that next days.
In this article i will take part of starting and stoping options of OEM.

Firstly we have to go OEM directory $ORACLE_HOME/bin/ 

Status OEM
[oracle@orcl bin]$ emctl status dbconsole
Oracle Enterprise Manager 11g Database Control Release 11.2.0.1.0
Copyright (c) 1996, 2009 Oracle Corporation.  All rights reserved.
https://orcl.localdomain:1158/em/console/aboutApplication
Oracle Enterprise Manager 11g is not running.
------------------------------------------------------------------
Logs are generated in directory /u01/app/oracle/product/11.2.0/db_1/orcl.localdomain_orcl/sysman/log
Starting OEM
emctl start dbconsole;
Oracle Enterprise Manager 11g Database Control Release 11.2.0.1.0
Copyright (c) 1996, 2009 Oracle Corporation.  All rights reserved.
https://orcl.localdomain:1158/em/console/aboutApplication
Starting Oracle Enterprise Manager 11g Database Control............ started.
------------------------------------------------------------------
Logs are generated in directory /u01/app/oracle/product/11.2.0/db_1/orcl.localdomain_orcl/sysman/log
Stoping OEM
emctl stop dbconsole
Oracle Enterprise Manager 11g Database Control Release 11.2.0.1.0
Copyright (c) 1996, 2009 Oracle Corporation.  All rights reserved.
https://orcl.localdomain:1158/em/console/aboutApplication
Stopping Oracle Enterprise Manager 11g Database Control ...
 ...  Stopped.




Thursday, March 8, 2012

Installing RLWRAP command on linux

In this article we shell see how to install Rlwrap(read line wrapper) which very useful program on Linux and use it.
So, all you need download Rlwrap.tar.gz from this site and complete it.
1) Download Rlwrap/

Or if you are on ubuntu OS use: sudo apt-get install rlwrap

2)
[oracle@orcl tmp]$   tar -xvf rlwrap-0.37.tar
rlwrap-0.37/
rlwrap-0.37/completions/
rlwrap-0.37/completions/testclient
rlwrap-0.37/completions/coqtop
rlwrap-0.37/doc/
rlwrap-0.37/doc/rlwrap.man.in
rlwrap-0.37/doc/Makefile.am

3) Now trun to root user and configure Rlwrap
[oracle@orcl rlwrap-0.37]$./configure
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking whether make sets $(MAKE)... (cached) yes
checking whether build environment is sane... yes.................................................................................................................................................................................

Now do:
    make (or gmake)  to build rlwrap
    make check       for instructions how to test it
    make install     to install it
4) Now we have to use make
# make
# make check
# make install
5) this step i'll set bash_profile in order to use rlwrap
[oracle@orcl ]$ vi .bash_profile

alias sql='rlwrap sqlplus'
alias dgmgrl='rlwrap dgmgrl'
alias rman='rlwrap rman'
alias lsnrctl='rlwrap lsnrctl'
alias asmcmd='rlwrap asmcmd'
alias adrci='rlwrap adrci'
alias impdp='rlwrap impdp'
alias expdp='rlwrap expdp'
And set it [oracle@orcl ]$. .bash_profile

Now you can use the alias for easy way :) 

I think, DBAs Love that rlwrap :)







Thursday, March 1, 2012

Startup And Shutdown Oracle Database Options

STARTUP ve SHUTDOWN

Before making Oracle Database available for any valid user, you must start up a database,
So startup have 3 mode 

1.NoMount mode,
2.Mount mode,
3.Open mode

Startup
When startup command is issued. Oracle looks for the parameter file in following order. SGA+BACKGROUND PROCESS Spifie<SID>.ora, init<SID>.ora

If we want to know the database on which instance. 
 " select open_mode from v$database " Using this command.

[oracle@orcl ~]$ su - oracle

[oracle@orcl ~]$ env | grep ORA
ORACLE_SID=ORCL
ORACLE_HOME=/u01/app/oracle/product/11.2.0/db_1
You can connect using either “/ as sysdba” or an oracle account that has DBA privilege.


[oracle@orcl ~]$ sqlplus '/ as sysdba'
SQL*Plus: Release 11.2.0.1.0 - Production on Sun Feb 20 10:40:28 2012
Copyright (c) 1982, 2009, Oracle.  All Rights Reserved.
Connected to an idle instance.
SQL>


 

SQL>startup; --> At first the database will go on "NOMOUNT" mode.
Then will go 
            MOUNT and at the final mode will be OPEN




NOMOUNT MODE: Oracle is reading paramater files (INITORA, SPFILE). 

It allocating memory(SGA), Starting backgraound processes. 

We can use "STARTUP QUIET"command in order to pass this option.
 SQL> startup nomount;
ORACLE instance started.

Total System Global Area  276197376 bytes
Fixed Size                  1335980 bytes
Variable Size             171969876 bytes
Database Buffers           96468992 bytes
Redo Buffers                6422528 bytes


MOUNT MODE: .The most important this is Oracle is reading Control files whichs instance mounted. Oracle check datafile and Log files. If there were any corruptions Oracle wont be open.

 ALTER DATABASE MOUNT; This command can be used when database is in nomount.



Database altered.
SQL> ALTER DATABASE OPEN; This comman can be used when database is in mounted. it will check datafiles and redolog files.


Database altered.
1) STARTUP [MOUNT/NOMOUNT/OPEN] RESTRICT; --> This comman is using for priviled User except this user others cant be connected in this mode How ever if any user have RESTRICTED SESSION role then its not up on that user.
SQL> ALTER SYSTEM  ENABLE RESTRICTED SESSION; For valid Restrict mode
SQL> ALTER SYSTEM  DISABLE RESTRICTED SESSION; For unvalid Restrict mode

select logins from v$instance; This select will show us the instance mode.


SQL> ALTER SYSTEM QUIESCE RESTRICTED; This command will wait until the active user 
finish trunsactions.
SQL> ALTER SYSTEM UNQUIESCE; 
SQL> select active_state from v$instance;

2) STARTUP [MOUNT/NOMOUNT/OPEN] FORCE; --> Database will be "SHUTDOWN ABORT" and then Opened again.
3) STARTUP [MOUNT/NOMOUNT/OPEN] EXCLUSIVE; -->This command will functionally identical to Above.


SHUTDOWN


1) SHUTDOWN [NORMAL]; --> The database waits for all users to disconnect, 
Oracle waits for all users to exit their sessions before shutting down the database
Oracle closes the data files and terminates the background processes. Oracle’s SGA is deallocated.
SQL> shutdown
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL>
2) SHUTDOWN IMMEDIATE; --> Oracle immediately disconnects all users. Oracle terminates all currently executing transactions.Oracle terminates the background processes and deallocates memory. No instance recovery is required on startup.
SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL>
3) SHUTDOWN ABORT; --> Oracle doesn’t roll back the terminated transactions. Oracle doesn’t write the redo log buffers and data buffers to disk.This doesn’t wait for anything. 

SQL> shutdown abort
ORACLE instance shut down.
SQL>