Server Configuration

Oracle11g
http://education.oracle.com/pls/web_prod-plq-dad/db_pages.getpage?page_id=5001&get_params=p_exam_id:11GOCM

Server Configuration
Note:- section 0: Creating a database 45 minutes

#oracle software installation
#Configure prerequisites

su - root
[root@ocm11g-lab ~]# groupadd oinstall
[root@ocm11g-lab ~]# groupadd dba
[root@ocm11g-lab ~]# groupadd oper

[root@ocm11g-lab ~]# useradd -g oinstall -G dba oracle
[root@ocm11g-lab ~]# passwd oracle

[root@ocm11g-lab ~]# tail -1 /etc/passwd
oracle:x:501:501::/home/oracle:/bin/bash
[root@ocm11g-lab ~]# tail -3 /etc/group
oinstall:x:501:
dba:x:502:oracle
oper:x:503:

[root@ocm11g-lab ~]# mkdir -p /u01/app/oracle/product/11.2.0/db_1
[root@ocm11g-lab ~]# chown -R oracle:oinstall /u01/app/oracle/product/11.2.0/db_1
[root@ocm11g-lab ~]# chmod 774 /u01/app/oracle/product/11.2.0/db_1
[root@ocm11g-lab ~]# chown -R oracle:oinstall /u01
[root@ocm11g-lab ~]# chmod 774 /u01/

[root@ocm11g-lab oracle]# echo "oracle soft nproc" >> /etc/security/limits.conf
[root@ocm11g-lab oracle]# echo "oracle hard nproc" >> /etc/security/limits.conf
[root@ocm11g-lab oracle]# echo "oracle soft nofile" >> /etc/security/limits.conf
[root@ocm11g-lab oracle]# echo "oracle hard nofile" >> /etc/security/limits.conf
[root@ocm11g-lab oracle]# tail -4 /etc/security/limits.conf
oracle soft nproc
oracle hard nproc
oracle soft nofile
oracle hard nofile

#Configure base profile with shortcut alias

su - oracle
#Base_Profiles
cat .bash_profile
#Settings
TMP=/tmp; export TMP
ORACLE_HOSTNAME=ocm11g-lab; export ORACLE_HOSTNAME
ORACLE_SID=ocm11g; export ORACLE_SID
ORACLE_BASE=/u01/app/oracle; export ORACLE_BASE
ORACLE_HOME=$ORACLE_BASE/product/11.2.0/db_1; export ORACLE_HOME
LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib; export LB_LIBRARY_PARH
CLASSPATH=$ORACLE_HOME/jre:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib; export CLASSPATH
PATH=$ORACLE_HOME/bin:/usr/sbin:$PATH; export PATH
#OCM Alias
alias abort='echo shutdown abort|sqlplus -L -s / as sysdba'
alias alert='tail -100f $ORACLE_BASE/diag/rdbms/orcl/orcl/trace/alert_$ORACLE_SID.log'
alias nomount='echo startup nomount quiet|sqlplus -L -s / as sysdba'
alias ora='cd $ORACLE_HOME'
alias pmon='ps -ef | grep [p]mon'
alias startup='echo startup quiet|sqlplus -L -s / as sysdba'
alias sysdba='sqlplus -L / as sysdba'
alias tns='cd $ORACLE_HOME/network/admin'
alias dbs='cd $ORACLE_HOME/dbs'

#Silent Installation

#Prepare the silent file

cd /opt/database/response

-bash-3.2$ cat db_install.rsp | grep -v '^#' | sed '/^$/d' > mysilent.rsp

#Modify the silent file
vi mysilent.rsp and edit accordingly

[root@ocm11g-lab response]# cat mysilent.rsp
oracle.install.responseFileVersion=/oracle/install/rspfmt_dbinstall_response_schema_v11_2_0
oracle.install.option=INSTALL_DB_SWONLY
ORACLE_HOSTNAME=ocm11g-lab
UNIX_GROUP_NAME=oinstall
INVENTORY_LOCATION=/u01/app/orainventory
SELECTED_LANGUAGES=en
ORACLE_HOME=/u01/app/oracle/product/11.2.0/db_1
ORACLE_BASE=/u01/app/oracle
oracle.install.db.InstallEdition=EE
oracle.install.db.EEOptionsSelection=true
oracle.install.db.optionalComponents=oracle.rdbms.partitioning:11.2.0.3.0,
oracle.oraolap:11.2.0.3.0,oracle.rdbms.dm:11.2.0.3.0,
oracle.rdbms.dv:11.2.0.3.0,oracle.rdbms.lbac:11.2.0.3.0,oracle.rdbms.rat:11.2.0.3.0
oracle.install.db.DBA_GROUP=dba
oracle.install.db.OPER_GROUP=oper
oracle.install.db.CLUSTER_NODES=
oracle.install.db.isRACOneInstall=
oracle.install.db.racOneServiceName=
oracle.install.db.config.starterdb.type=
oracle.install.db.config.starterdb.globalDBName=
oracle.install.db.config.starterdb.SID=
oracle.install.db.config.starterdb.characterSet=AL32UTF8
oracle.install.db.config.starterdb.memoryOption=true
oracle.install.db.config.starterdb.memoryLimit=
oracle.install.db.config.starterdb.installExampleSchemas=false
oracle.install.db.config.starterdb.enableSecuritySettings=true
oracle.install.db.config.starterdb.password.ALL=
oracle.install.db.config.starterdb.password.SYS=
oracle.install.db.config.starterdb.password.SYSTEM=
oracle.install.db.config.starterdb.password.SYSMAN=
oracle.install.db.config.starterdb.password.DBSNMP=
oracle.install.db.config.starterdb.control=DB_CONTROL
oracle.install.db.config.starterdb.gridcontrol.gridControlServiceURL=
oracle.install.db.config.starterdb.automatedBackup.enable=false
oracle.install.db.config.starterdb.automatedBackup.osuid=
oracle.install.db.config.starterdb.automatedBackup.ospwd=
oracle.install.db.config.starterdb.storageType=
oracle.install.db.config.starterdb.fileSystemStorage.dataLocation=
oracle.install.db.config.starterdb.fileSystemStorage.recoveryLocation=
oracle.install.db.config.asm.diskGroup=
oracle.install.db.config.asm.ASMSNMPPassword=
MYORACLESUPPORT_USERNAME=
MYORACLESUPPORT_PASSWORD=
SECURITY_UPDATES_VIA_MYORACLESUPPORT=
DECLINE_SECURITY_UPDATES=true
PROXY_HOST=
PROXY_PORT=
PROXY_USER=
PROXY_PWD=
PROXY_REALM=
COLLECTOR_SUPPORTHUB_URL=
oracle.installer.autoupdates.option=SKIP_UPDATES
oracle.installer.autoupdates.downloadUpdatesLoc=
AUTOUPDATES_MYORACLESUPPORT_USERNAME=
AUTOUPDATES_MYORACLESUPPORT_PASSWORD=

#Install the INSTALL_DB_SWONLY

./runInstaller -ignoreSysPrereqs -silent -force -responseFile /opt/OCM11g_Source/database/response/mysilent.rsp

#Post installation

echo "orcl:/u01/app/oracle/product/11.2.0/db_1:Y" >> /etc/oratab

sh /u01/app/orainventory/orainstRoot.sh
sh /u01/app/oracle/product/11.2.0/db_1/root.sh

#Network Configuration

cd $ORACLE_HOME/network/admin
or
tns
vi listener.ora
LISTENER=
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP) (HOST =192.168.144.2) (PORT = 1521))
)
)
)

SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(GLOBAL_DBNAME = ocm11g)
(ORACLE_HOME = /u01/app/oracle/product/11.2.0/db_1)
(SID_NAME = ocm11g)
)
)

vi tnsnames.ora
ocm11g =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP) (HOST =192.168.144.2) (PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = ocm11g)
)
)

#Create Password file
dbs

orapwd file=orapworcl.ora enties=5 password=oracle

Create manual database

Create database using CLI
1. Create a init.ora for the new database in the $ORACLE_HOME/dbs directory.Here, the minimal init.ora, I have used to start the database:

db_name=ocm11g
db_block_size=8192
undo_management=auto
undo_tablespace=undotbs
diagnostic_dest='/u01/app/oracle'
db_cache_size=80M
shared_pool_size=130M
java_pool_size=48M

2. Now, you can start the instance.

sqlplus “/as sysdba”
startup nomount;

3. When the instance is started, you can create the database:

sqlplus "/as sysdba"
create database ocm11g
user sys identified by ********
user system identified by ***********
maxlogfiles 3
maxlogmembers 3
maxdatafiles 20
character set al32utf8
logfile group 1 ('/oracle/oradata/redo1_a.log','/oracle/oradata/redo1_b.log') size 50M blocksize 512,
group 2 ('/oracle/oradata/redo2_a.log','/oracle/oradata/redo2_b.log') size 50M blocksize 512,
group 3 ('/oracle/oradata/redo3_a.log','/oracle/oradata/redo3_b.log') size 50M blocksize 512
datafile '/oracle/oradata/system.dbf' size 500M extent management local
sysaux datafile '/oracle/oradata/sysaux.dbf' size 500M
undo tablespace undotbs datafile '/oracle/oradata/undotbs.dbf' size 200M
default temporary tablespace temp tempfile '/oracle/oradata/temp.dbf' size 200M uniform size 1M;

If all the paths are OK, the new database will be created and opened.

4. Now, you have to run some sql scripts to create a catalog an procedures:

sqlplus "/as sysdba"
@?/rdbms/admin/catalog.sql
@?/rdbms/admin/catproc.sql

sqlplus system/***********
@?/sqlplus/admin/pupbld.sql

5. Now restart the database and create a default tablespace for users:

sqlplus "/as sysdba"
shu immediate
startup

create tablespace user s datafile '/oracle/oradata/users.dbf' size 20M;
alter database default tablespace users;

The database is in noarchivelog mode, so you can change it when needed.

#Create Database using OMF

#Make directory

cd $ORACLE_BASE

mkdir -p admin/orcl/adump flash_recovery_area oradata

#Prepare initialization file

dbs
cat init.ora | grep -v '^#' | sed '/^$/d' | tr -d '<>' > initorcl.ora
or
vi and search/replace
:%s/ORACLE_BASE/$ORACLE_BASE

cat orginit.ora | grep -v '^#' | sed '/^$/d' | tr -d '<>' | sed 's/ORACLE_BASE/$ORACLE_BASE/g' > initorcl.ora
echo "db_create_file_dest='/u01/app/oracle'" >> initorcl.ora

vi and delete below entries
undo_tablespace
control_files

modify below enties
memory_target=300M

#Create Database

dbs
cp init.ora orginit.ora

nomount
CREATE DATABASE ORCL
CHARACTER SET AL32UTF8;

OR

CREATE DATABASE elitedb
USER SYS IDENTIFIED BY SYS
USER SYSTEM IDENTIFIED BY SYSTEM
CHARACTER SET AL32UTF8
DEFAULT TEMPORARY TABLESPACE TEMP
DEFAULT TABLESPACE USERS;

Note:-
once the database creation is completed then please check logs using alert command
repeat step 4

Configure DEFAULT DATABASE PROPERTIES

CREATE TABLESPACE USERS;

ALTER DATABASE DEFAULT TABLESPACE USERS;

CREATE TEMPORARY TABLESPACE TEMP01;

ALTER DATABASE DEFAULT TEMPORARY TABLESPACE TEMP01;

#Create spfile from pfile
SQL> create pfile from memory;
-bash-3.2$ cat initorcl.ora | grep -v ‘^_’ | grep -v ‘#Deprecate’ > initorcl2.ora
-bash-3.2$ mv initorcl2.ora initorcl.ora
startup
SQL> create spfile from pfile;

Note: Drop the Database using CLI
-bash-3.2$ ./dbca -silent -deleteDatabase -sourceDB ocm11g
Connecting to database
4% complete
9% complete
14% complete
19% complete
23% complete
28% complete
47% complete
Updating network configuration files
52% complete
Deleting instance and datafiles
76% complete
100% complete
Look at the log file “/u01/app/oracle/cfgtoollogs/dbca/ocm11g.log” for further details.

ref
http://niscodba.weebly.com/2/post/2011/04/create-database-manually.html
http://niscodba.weebly.com/2/post/2011/04/create-database-using-dbca.html
http://niscodba.weebly.com/2/post/2011/04/create-database-manually-using-omf.html
http://niscodba.weebly.com/2/post/2011/04/create-database-manually-using-omf.html

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s