Category: ORACLE DATABASE


DBCA:( Database configuration assistant) :- The dbca utility is typically located in ORACLE_HOME/bin.With dbca we can create database only after installing oracle database binaries.

As a oracle user execute dbca from $OACLE_HOME/bin as shown below.Use GUI mode to launch console.

[oracle@localhost ~]$ cd $ORACLE_HOME
[oracle@localhost dbhome_1]$ cd bin/
[oracle@localhost bin]$ ./dbca

 

Image

Select Next.

Image

select Create database and then Next.

Image

Select General perpose and then Next.

Image

Enter the SID( database name) of your choice then Next.

Image

Since i don’t use OEM , so i unchecked the configure enterprise manager option.

Image

Specify the administrator user password and then Next.

Image

Select the location where to save the datafiles whether as specified in template or other location.

Image

I didnt change any values , Selecting Next button without changing any values.

Image

I am not going to add any sample schemas in database , so i am just selecting Next.

Image

Above you can change Memory size and character set in different tabs.Then Next.

Image

Select Next.

Image

Select Create database button to create database or select create template to create database template which can be further used to create database with above parameter values specified.

If you select Generate create database scripts to create database with response file(silent instillation)

Then  finish.

Image

Select ok.

Image

Database creation has been in progress.Once it is done , select exit in popup.

Hardware requirements:

Kernel Requirements On Oracle Linux 6
2.6.32-100.28.5.el6.x86_64 or later . To verify execute the  “uname -r” command.

Memory Requirements:

Minimum: 1 GB of RAM. To verify execute “grep MemTotal /proc/meminfo” command.

Swap memeoy should be 1.5 times of RAM. to verify execute “grep SwapTotal /proc/meminfo” command.

Disk Space Requirements:

At least 1 GB of disk space in the /tmp directory.To verify execute “df -h /tmp” command.

And for database binaries and datafiles size depends on the type of installations , its better to have 10 GB of free space where datafiles and binaries recedes.

 Package Requirements:

The following or later version of packages for Oracle Linux 6, and Red Hat Enterprise Linux 6 must be installed:
binutils-2.20.51.0.2-5.11.el6 (x86_64)
compat-libcap1-1.10-1 (x86_64)
compat-libstdc++-33-3.2.3-69.el6 (x86_64)
compat-libstdc++-33-3.2.3-69.el6.i686
gcc-4.4.4-13.el6 (x86_64)
gcc-c++-4.4.4-13.el6 (x86_64)
glibc-2.12-1.7.el6 (i686)
glibc-2.12-1.7.el6 (x86_64)
glibc-devel-2.12-1.7.el6 (x86_64)
glibc-devel-2.12-1.7.el6.i686
ksh
libgcc-4.4.4-13.el6 (i686)
libgcc-4.4.4-13.el6 (x86_64)
libstdc++-4.4.4-13.el6 (x86_64)
libstdc++-4.4.4-13.el6.i686
11
libstdc++-devel-4.4.4-13.el6 (x86_64)
libstdc++-devel-4.4.4-13.el6.i686
libaio-0.3.107-10.el6 (x86_64)
libaio-0.3.107-10.el6.i686
libaio-devel-0.3.107-10.el6 (x86_64)
libaio-devel-0.3.107-10.el6.i686
make-3.81-19.el6
sysstat-9.0.4-11.el6 (x86_64)

Oracle ODBC Drivers :

On Oracle Linux 6 and Red Hat Enterprise Linux 6:
– unixODBC-2.2.14-11.el6 (x86_64) or later
– unixODBC-2.2.14-11.el6.i686 or later
– unixODBC-devel-2.2.14-11.el6 (x86_64) or later
– unixODBC-devel-2.2.14-11.el6.i686 or later

Installation Procedure 

1. Download Oracle database software from OTN.

2.If you downloaded on windows, use WinScp or some other tool to copy to Linux.

3. Unzip the zip files on your Linux machine.

4.Creating oracle user and groups.

[root@varun ~]# /usr/sbin/groupadd oinstall

[root@varun ~]# /usr/sbin/groupadd dba

[root@varun ~]# /usr/sbin/useradd -g oinstall -G dba oracle

[root@varun ~]# passwd oracle
Changing password for user oracle.
New password:
BAD PASSWORD: it is too short
BAD PASSWORD: is too simple
Retype new password:
passwd: all authentication tokens updated successfully.
[root@varun ~]#

5. creating directories for oracle binaries.

[root@varun ~]# mkdir -p /dboracle/app/

[root@varun ~]# chown -R oracle:oinstall /dboracle/app/

[root@varun ~]# chmod -R 775 /dboracle/app/

6.Installing RPM’s

Make sure you  have installed all the above rpms , that specified

To install rpm execute “rpm -ivh ********” to verify whether it is already exist execute “rpm -qa ***********” .

You can also use YUM utility to install rpms . YUM configuration is explained in my previous post.

Configuring Kernel Parameters

Add below parameters in /etc/sysctl.conf file using text editer.If those values already exists then skip those parameters .

fs.aio-max-nr = 1048576
fs.file-max = 6815744
kernel.shmall = 2097152
kernel.shmmax = 536870912
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
net.ipv4.ip_local_port_range = 9000 65500
net.core.rmem_default = 262144
net.core.rmem_max = 4194304
net.core.wmem_default = 262144
net.core.wmem_max = 1048576

after adding above parameters run the “/sbin/sysctl -p” command from your terminal.

Below error i  got after running sysctl -p

error: “net.bridge.bridge-nf-call-ip6tables” is an unknown key
error: “net.bridge.bridge-nf-call-iptables” is an unknown key
error: “net.bridge.bridge-nf-call-arptables” is an unknown key

I have commented those parameters in /etc/sysctl.conf file and i ran again “sysctl -p” command.

Check Resource Limits for the Oracle Software Installation Users

Make sure you have set below hard and soft limit values for oracle users , if not add below lines in /etc/security/limits.conf file using text editor.

oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536
oracle soft stack 10240

Install the Database binaries using runinstaller as a oracle user from the sofware location(database directory).Use GUI to launch the runinstaller .Make sure the oracle user has read,write and execute permissions on software location, if not grant 775 permission.

If you see any issues related to “java.lang. ….  ” some couple of lines or issue like “could not able to load display”. execute “xauth list” command as a root user, and then next as a oracle user execute xauth add (output which you got from above xauth list as root user)
example : as a root user

[root@varun Desktop]# xauth list

As a oracle user add above output of xuath list  to below xauth add.

[oracle@varun database]$ xauth add varun/unix:0  MIT-MAGIC-COOKIE-1  8e5dcac3f72c62dc0f2cc20ca3234136

Launching runinstaller 

[oracle@varun database]$ ./runInstaller

1

If you are not interested in receiving security updates from oracle , just uncheck the check button. Then Next.

2'

Select yes in popup.

3

I selected the skip software updates, since i dosent require to get updates from oracle directly.Then Next.

4

I selected install software only.

5

select the single instance database.

6

By default English language is selected. select Next.

7

select type of installation, then Next.

8

Browse oracle home and oracle base directory and Next.

9

Browse the oracle inventory location . Then Next.

11

Verify the database administrator and operator group. Then Next.

I got an error message in next page , it says “ins-30060 check for group existence failed” i have checked lot of stuff in metalink and google.By rebooting the server  issue got fixed.

12

 

above packages are missed , i am going to install those with YUM , as YUM will take care of perquisites and dependencies , makes simple to install.

I didnt find pdksh package in my YUM repository , So i googled and downloaded  from site.

14

 

My Physical memory(RAM) is not enough , so i am ignoring this warning and proceeding with next  .

15

 

16

 

select install.

17

18

 

 

As a root user run both above scripts.

Add below  environment variables to  bash profile or into script .

export ORACLE_HOME=/home/oracle/app/oracle/product/11.2.0/dbhome_1
export ORACLE_BASE=/home/oracle/app/
export PATH=/home/oracle/app/oracle/product/11.2.0/dbhome_1/bin:$PATH

 

 

 

 

1. Create default tablespace to rman utility user (OPTIONAL)

sqlplus / as sysdba

SQL*Plus: Release 11.2.0.2.0 Production on Wed Oct 24 02:51:36 2012

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

Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 – 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL>create tablespace varun datafile ‘/o001/app/oracle/PSDMO7/varun.dbf’ size 250m;

Tablespace created.

2.creating RMAN utility user in database to store backup info.

SQL> create user varun identified by varun default tablespace varun quota unlimited on varun;

User created.

SQL> grant recovery_catalog_owner to varun;

Grant succeeded.
SQL> exit

3. Creating CATALOG database

$ rman catalog varun/varun

Recovery Manager: Release 11.2.0.2.0 – Production on Wed Oct 24 03:25:46 2012

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

connected to recovery catalog database

RMAN> create catalog;

recovery catalog created

RMAN>

4. Registering Target Database under catalog database

$rman target kumar/kumar@PSDMO8 catalog varun/varun

Recovery Manager: Release 11.2.0.2.0 – Production on Wed Oct 24 03:36:18 2012

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

connected to target database: PSDMO8 (DBID=3631729544)
connected to recovery catalog database

RMAN> register database;

database registered in recovery catalog
starting full resync of recovery catalog
full resync complete

RMAN>

NOTE:If you see any issues related to privileges while registering database, you can grant sysdba privilege to rman utility user on target database  ” grant sysdba to varun” after creating catalog database. Granting sysdba to rman utility user is not recommended.

Start the database with pfile

Take the backup of existing initialization Parameter file(pfile)

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

Total System Global Area  409194496 bytes
Fixed Size                  2226992 bytes
Variable Size             268436688 bytes
Database Buffers          134217728 bytes
Redo Buffers                4313088 bytes
Database mounted.
SQL> sho parameter pfile;

NAME                                 TYPE        VALUE
———————————— ———– ——————————
spfile                               string

SQL> select dbid,name from v$database;

DBID NAME
———- ———
2076663514 TEST

SQL>!

[oracle@localhost ~]$ nid target=sys DBNAME=varun SETNAME=y

DBNEWID: Release 11.2.0.2.0 – Production on Thu Mar 22 17:56:48 2012

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

Password:
Connected to database TEST (DBID=2076663514)

Connected to server version 11.2.0

Control Files in database:
/varun/oraclehome/oraclebase/varun/control01.ctl
/varun/oraclehome/oraclebase/fast_recovery_area/varun/control02.ctl

Change database name of database TEST to VARUN? (Y/[N]) => Y

Proceeding with operation
Changing database name from TEST to VARUN
Control File /varun/oraclehome/oraclebase/varun/control01.ctl – modified
Control File /varun/oraclehome/oraclebase/fast_recovery_area/varun/control02.ctl – modified
Datafile /varun/oraclehome/oraclebase/varun/system01.db – wrote new name
Datafile /varun/oraclehome/oraclebase/varun/sysaux01.db – wrote new name
Datafile /varun/oraclehome/oraclebase/varun/undotbs01.db – wrote new name
Datafile /varun/oraclehome/oraclebase/varun/users01.db – wrote new name
Datafile /varun/oraclehome/oraclebase/varun/temp01.db – wrote new name
Control File /varun/oraclehome/oraclebase/varun/control01.ctl – wrote new name
Control File /varun/oraclehome/oraclebase/fast_recovery_area/varun/control02.ctl – wrote new name
Instance shut down

Database name changed to VARUN.
Modify parameter file and generate a new password file before restarting.
Succesfully changed database name.
DBNEWID – Completed succesfully.

  • Set the DB_NAME initialization parameter in the initialization parameter file to the new database name
  • Change the ORACLE_ SID  which was set in environment variables
  • change the old initialization  parameter file to newly changed

SQL> startup
ORACLE instance started.

Total System Global Area  409194496 bytes
Fixed Size                  2226992 bytes
Variable Size             281019600 bytes
Database Buffers          121634816 bytes
Redo Buffers                4313088 bytes
Database mounted.
Database opened.
SQL> select name,dbid from v$database;

NAME            DBID
——— ———-
VARUN     2076663514

 

Start the database with pfile

Take the backup of existing initialization Parameter file(pfile)

SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup mount;
ORACLE instance started.

Total System Global Area  409194496 bytes
Fixed Size                  2226992 bytes
Variable Size             281019600 bytes
Database Buffers          121634816 bytes
Redo Buffers                4313088 bytes
Database mounted.
SQL> !
[oracle@localhost ~]$  nid TARGET=sys/sys@psdmo9 DBNAME=varun

DBNEWID: Release 11.2.0.2.0 – Production on Thu Mar 15 21:25:08 2012

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

Connected to database PSDMO9 (DBID=1666743069)

Connected to server version 11.2.0

Control Files in database:
/varun/oraclehome/oraclebase/psdmo9/control01.ctl
/varun/oraclehome/oraclebase/fast_recovery_area/psdmo9/control02.ctl

Change database ID and database name PSDMO9 to VARUN? (Y/[N]) => Y

Proceeding with operation
Changing database ID from 1666743069 to 2761382452
Changing database name from PSDMO9 to VARUN
Control File /varun/oraclehome/oraclebase/psdmo9/control01.ctl – modified
Control File /varun/oraclehome/oraclebase/fast_recovery_area/psdmo9/control02.ctl – modified
Datafile /varun/oraclehome/oraclebase/psdmo9/system01.db – dbid changed, wrote new name
Datafile /varun/oraclehome/oraclebase/psdmo9/sysaux01.db – dbid changed, wrote new name
Datafile /varun/oraclehome/oraclebase/psdmo9/undotbs01.db – dbid changed, wrote new name
Datafile /varun/oraclehome/oraclebase/psdmo9/users01.db – dbid changed, wrote new name
Datafile /varun/oraclehome/oraclebase/psdmo9/temp01.db – dbid changed, wrote new name
Control File /varun/oraclehome/oraclebase/psdmo9/control01.ctl – dbid changed, wrote new name
Control File /varun/oraclehome/oraclebase/fast_recovery_area/psdmo9/control02.ctl – dbid changed, wrote new name
Instance shut down

Database name changed to VARUN.
Modify parameter file and generate a new password file before restarting.
Database ID for database VARUN changed to 2761382452.
All previous backups and archived redo logs for this database are unusable.
Database is not aware of previous backups and archived logs in Recovery Area.
Database has been shutdown, open database with RESETLOGS option.
Succesfully changed database name and ID.
DBNEWID – Completed succesfully.


  • Set the DB_NAME initialization parameter in the initialization parameter file to the new database name
  • Change the ORACLE_ SID  which was set in environment variables
  • change the old initialization  parameter file to newly changed

EX: mv /varun/oraclehome/oraclebase/home/dbs/initpsdmo9.ora  /varun/oraclehome/oraclebase/home/dbs/initVARUN.ora

[oracle@localhost dbs]$ sqlplus ‘/as sysdba’

SQL*Plus: Release 11.2.0.2.0 Production on Thu Mar 15 21:29:10 2012

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

Connected to an idle instance.

SQL> startup mount;
ORACLE instance started.

Total System Global Area  409194496 bytes
Fixed Size                  2226992 bytes
Variable Size             281019600 bytes
Database Buffers          121634816 bytes
Redo Buffers                4313088 bytes
Database mounted.
SQL> alter database open resetlogs;

Database altered.

SQL> select name from v$database;

NAME
———
VARUN

[oracle@localhost ~]$ sqlplus ‘/as sysdba’

SQL*Plus: Release 11.2.0.2.0 Production on Thu Mar 15 20:44:52 2012

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

Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 – 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.

SQL> startup mount
ORACLE instance started.

Total System Global Area  409194496 bytes
Fixed Size                  2226992 bytes
Variable Size             281019600 bytes
Database Buffers          121634816 bytes
Redo Buffers                4313088 bytes
Database mounted.

SQL> !

[oracle@localhost ~]$ nid target = sys

DBNEWID: Release 11.2.0.2.0 – Production on Thu Mar 15 20:49:20 2012

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

Password:
Connected to database PSDMO9 (DBID=1666710808)

Connected to server version 11.2.0

Control Files in database:
/varun/oraclehome/oraclebase/psdmo9/control01.ctl
/varun/oraclehome/oraclebase/fast_recovery_area/psdmo9/control02.ctl

Change database ID of database PSDMO9? (Y/[N]) => Y

Proceeding with operation
Changing database ID from 1666710808 to 1666743069
Control File /varun/oraclehome/oraclebase/psdmo9/control01.ctl – modified
Control File /varun/oraclehome/oraclebase/fast_recovery_area/psdmo9/control02.ctl – modified
Datafile /varun/oraclehome/oraclebase/psdmo9/system01.db – dbid changed
Datafile /varun/oraclehome/oraclebase/psdmo9/sysaux01.db – dbid changed
Datafile /varun/oraclehome/oraclebase/psdmo9/undotbs01.db – dbid changed
Datafile /varun/oraclehome/oraclebase/psdmo9/users01.db – dbid changed
Datafile /varun/oraclehome/oraclebase/psdmo9/temp01.db – dbid changed
Control File /varun/oraclehome/oraclebase/psdmo9/control01.ctl – dbid changed
Control File /varun/oraclehome/oraclebase/fast_recovery_area/psdmo9/control02.ctl – dbid changed
Instance shut down

Database ID for database PSDMO9 changed to 1666743069.
All previous backups and archived redo logs for this database are unusable.
Database is not aware of previous backups and archived logs in Recovery Area.
Database has been shutdown, open database with RESETLOGS option.
Succesfully changed database ID.
DBNEWID – Completed succesfully.

SQL> startup mount
ORACLE instance started.

Total System Global Area  409194496 bytes
Fixed Size                  2226992 bytes
Variable Size             281019600 bytes
Database Buffers          121634816 bytes
Redo Buffers                4313088 bytes
Database mounted.
SQL> alter database open resetlogs;
Database altered.
SQL>  select dbid from v$database;
DBID
———-
1666743069