Vous êtes sur la page 1sur 19

WI – Linux Database

Creation 12.1.0.x.x on Oracle


ASM

Author: Sergio Masciotra,


Paul Scotto
Creation Date: January 8, 2014
Last Updated: February 3, 2015
Version: 3.0

WI – Linux Database Creation Process 11.2.0.x.x on Oracle ASM 1


Document Control
Change Record

Date Author Version Change Reference

12-May-11 Sergio Masciotra 1.0 Created


19-Dec-11 Sergio Masciotra 2.0 Added Post database Verification/Qualification section
04-Jun-13 Reddy Loka 2.1 Updated Step 11 of create database section to include
Change directory.

08-Jan-2014 Paul Scotto 3.0 Copied from 11g. Updated for 12c.
28-Mar-2014 Paul Scotto 3.0 Updated for 12.1.0.1:
- Changed ftp to sftp
- Added comments to highlight using correct script
versions
- Removed step to create password function since it is done
in the scripts
- Removed reference to opening a Remedy case for asset
management.
- Added custom variables for version numbers

04-Feb-2015 Paul Scotto 3.0 - Added check for OEM 12c agent
- Modified reverences fro EM10g to EM
- Removed Appendix B - Disk Backup configuration

WI – Linux Database Creation Process 11.2.0.x.x on Oracle ASM 2


List of Involved Parties

Title Name Email Role/Responsibility

DBA Sergio sergio_masciotra@merck.com


Masciotra
DBA Paul Scotto paul_scotto@merck.com

WI – Linux Database Creation Process 11.2.0.x.x on Oracle ASM 3


Executive Summary

This document describes the creation of an Oracle 12.1.0.x.x database using Oracle Managed
Files and Oracle ASM.

WI – Linux Database Creation Process 11.2.0.x.x on Oracle ASM 4


Pre-Requisite

9 LINUX account <Oracle owner e.g. ormerck>, group <Unix Group e.g. dbmerck> must exist.
9 Oracle Software needs to be installed for user <Oracle owner e.g. ormerck>.
9 Oracle ASM instance available and Disk groups DG1 and FRA1 mounted

WI – Linux Database Creation Process 11.2.0.x.x on Oracle ASM 5


Environment Preparation

• Oracle ASM Disk Group Verification

Step Activity Expected Results

1.
Start an ssh session and login to server as User <Oracle owner
[Oracle_Owner i.e. ormerck] e.g. ormerck> logged
on.
2. Change the environment to +ASM by running: Environment set

. oraenv

3. Login to ASM instance as follows: Successfully logged


in.
sqlplus "/ as sysasm"

4. Verify that DG1 and FRA1 disk groups exist and are Disk groups verified.
mounted using script in Appendix A.

5. Verify that there is sufficient free space available Sufficient free space
using script in Appendix A. available.

WI – Linux Database Creation Process 11.2.0.x.x on Oracle ASM 7


• Environment Verification

Step Activity Expected Results

1.
Check EM Agent 12c agent processes
> ps -fu oraepm|grep agent running under oraepm
like:
Check for 12c agent /opt/oracle/oraepm/agen
If emagent is not available then send an e-mail to t/core/12.1.0.3.0/perl/bi
Prasanna Bekal to install the agent. n/perl

Note: It is acceptable to have both 10g and 12c


agents running.

2.
Add the following line to /etc/oratab: Line added to
/etc/oratab as
<SID>:/opt/oracle/<Oracle owner e.g. specified.
ormerck>/product/ <Oracle Version>:N.

3.
Change the environment to +ASM by running:

. oraenv

4.
Add the new database being created to the New DB entry added
listener.ora. to listener.ora

Please note that the listener is running from the ASM


$OH.
5.
Reload the listener to update the listener Listener reloaded and
configuration. verified

Ex:

lsnrctl reload ormerck_listener

and then verify that the new <SID> has been


registered:

lsnrctl status ormerck_listener

WI – Linux Database Creation Process 11.2.0.x.x on Oracle ASM 8


Create Database
Step Activity Expected Results

1.
Change the environment to <SID> by running: Environment set

. oraenv

2.
cd $ORACLE_BASE/admin Directory <SID> created
successfully.
mkdir -p $ORACLE_SID/create
3. Change directory to /opt/oracle/<Oracle owner e.g. Directory changed
ormerck>/admin/<Oracle Instance>/create

4. Copy the DB creation scripts from the Oracle Depot. Please note the Scripts copied
directory name is based on the Oracle DB version. Make sure to
download the correct version!

sftp ormerck@dbadepot

cd /opt/oracle/install/script_depot/Create_DB_Linux
cd 12101_ASM  Use correct version
mget *
bye

chmod 700 *

5.
Verify that the CreateDB.conf file entries correspond to Database CreateDB.conf modified to
Parameter values in APPENDIX A and modify if necessary. match environment
settings/requirements
Validate version and PSU

6.
Start the database creation: Database creation started
export PATH=$ORACLE_HOME/perl/bin/:$PATH
Make sure to use the correct version!

Ex:
./cr12101db_asm -p CreateDB.conf

7. DB Integrity and Functional Tests: Content verified


Change directory to /opt/oracle/<Oracle owner e.g.
ormerck>/admin/<Oracle Instance>/create/log
Verify the content of files:
1) cr12101db_asm_<SID>_log_functionality.txt
2) cr12101db_ asm_<SID>_ test_integrity.txt

8.
Verify all log files for unexpected errors Log files verified

9.
Create SPFILE from PFILE SPFILE created successfully

sqlplus "/ as sysdba"

create spfile='+DG1' from pfile;

WI – Linux Database Creation Process 11.2.0.x.x on Oracle ASM 9


Create Database

10.
Source the ASM $OH, and execute asmcmd from the command line File name captured
and then navigate to the
+DG1/$ORACLE_SID/PARAMETERFILE directory and capture
the spfile.%.% filename

Ex:
cd +DG1/TESTDB01/PARAMETERFILE
ls -l sp*

11.
Next create an ASM alias pointing to the SPFILE in step 1) as Create ASM alias for spfile
follows:
cd +DG1/$ORACLE_SID
mkalias +DG1/$ORACLE_SID/PARAMETERFILE/spfile.%. %
spfile$ORACLE_SID.ora

Example:
cd +DG1/TESTDB01
mkalias
+DG1/TESTDB01/PARAMETERFILE/spfile.269.731254989
spfileTESTDB01.ora
12.
Source the $ORACLE_SID $ORACLE_HOME Proper environment sourced

.oraenv $ORACLE_SID

And Navigate to $ORACLE_BASE/admin/${ORACLE_SID}/pfile


13.
Rename existing init${ORACLE_SID}.ora as init${ORACLE_SID}.ora
init${ORACLE_SID}.ora[orig] file created

Then create init${ORACLE_SID}.ora with the following contents:


SPFILE=+DG1/${ORACLE_SID}/spfile${ORACLE_SID}.ora

echo
"SPFILE=+DG1/${ORACLE_SID}/spfile${ORACLE_SID}.ora" >
init${ORACLE_SID}.ora

14.
Shutdown and restart database, so that the spfile is used Database restarted and spfile
parameter is used
sqlplus "/ as sysdba"

shutdown immediate

startup

--Verify that spfile is being used as follows:

show parameters spfile

--Verify that the spfile specified in step 13) is being used.

15.
Enable Block Change Tracking (if not already enabled): Block Change Tracking
enabled.
select * from v$block_change_tracking;
alter database enable block change tracking using file '+DG1';

WI – Linux Database Creation Process 11.2.0.x.x on Oracle ASM 1


0
Post Database Creation – Misc. User Creation

Step Activity Expected Results

1. Change directory to Passwords/permissions


changed.
/opt/oracle/<Oracle owner e.g. ormerck>/admin/<Oracle
Instance>/create

Then create/alter the standard database users passwords/permissions:


sqlplus "/ as sysdba"

@ss_newdb_users.sql
2.
For SOX databases only: Permissions changed.
sqlplus "/ as sysdba"

@ ss_soxdb_users.sql
3.
Create standard Client-facing DBA account CF DBA account created
sqlplus "/ as sysdba" with grants.

@cfdba.sql

Exit sqlplus once script finishes executing

WI – Linux Database Creation Process 11.2.0.x.x on Oracle ASM 1


1
Post Database Creation – Oracle Restart Services

Step Activity Expected Results

1.
Source the ASM $OH and then register service as follows: replace all Database Registered with
occurrences of <SID> with proper $ORACLE_SID: Oracle Restart

srvctl add database -d <SID> -o /opt/oracle/ormerck/product/12.1.0.1.2


-p +DG1/<SID>/spfile<SID>.ora -n <SID> -r PRIMARY

srvctl modify database -d <SID> -y automatic -r PRIMARY -a


DG1,FRA1

crsctl modify resource ora.<sid>.db -attr "AUTO_START=always"

2.
Verify configuration: Configuration Verified.

srvctl config database -d <SID>


3.
Source the $ORACLE_SID $ORACLE_HOME and Shutdown Database shutdown
database using SQL*Plus normally.

.oraenv (reply: <SID>)

sqlplus “/ as sysdba”
shutdown immediate

4.
Start database using CRS: Database started
successfully using CRS.
srvctl start database -d ${ORACLE_SID}

Verify that database has been started:

srvctl status database -d ${ORACLE_SID}

WI – Linux Database Creation Process 11.2.0.x.x on Oracle ASM 1


2
Post Database Creation – Verification/Qualification

Step Activity Expected


Results

1.
Execute db Quality Gate verification against newly created database as per Work Quality Gate
Instructions: executed

http://webview.merck.com:80/webview/drl.html?objectId=090030f980dc141a

2.
Rectify verification items which have a 'FAIL' status. If the verifications fails due to Verification
an exception, document the item # and the reason (for exemption). Completed.

3.
Complete IQ/OQ as per instructions in step 4 if the newly created database is: Perform
1) A production database IQ/OQ in
2) A Formal Test database (Validated environments only) step 4 if
necessary
4.
If required, complete IQ/OQ following the following documents: Complete
IQ/OQ as per
Database IQOQ-KM KM
http://webview.merck.com:80/webview/drl.html?objectId=090030f980dc1419

and

ITSOP-0006.002_DB_SERVICES_Instance-Based_IQOQ_Template
http://webview.merck.com:80/webview/drl.html?objectId=090030f980dc141b

WI – Linux Database Creation Process 11.2.0.x.x on Oracle ASM 1


3
EM Monitoring and Backup Configuration

Step Activity Expected Results

1.
Refer to EM SOP for the setup of monitoring and Monitoring and
backups Backup SOP
performed
EM Migration Scenarios.doc
See details below

Enterprise Manager Details


EM Owner [PROD or NONPRD]
EM Backup Type [HOT or COLD]
EM Group Name [e.g. ESS, USHH, MRL]_SS_<Server Name>_[HOT or
COLD]
EM Group Exists? [Yes/No]
EM COLD Backup Schedule – FULL [e.g. Fri @ 23:00, N/A for HOT]]
EM COLD Backup Schedule – INCR [e.g. Daily @ 23:00, N/A for HOT]

WI – Linux Database Creation Process 11.2.0.x.x on Oracle ASM 1


4
Asset Management

Step Activity Expected Results

1.
Add the new database asset to REMEDY: Asset management
updated
Include the following information:
□ Instance name
□ Server name
□ Database owner
□ Date of creation
□ Oracle Version
□ NLS Characterset
□ Relate to Oracle Code Tree
□ Relate to Application System

WI – Linux Database Creation Process 11.2.0.x.x on Oracle ASM 1


5
Appendix A – ASM Scripts

• Verify Disk Group Status & space availability

column group_number Heading 'Disk Grp|No.' format 9999

column name Heading 'Disk Grp|Name' format A15

column total_gb Heading 'Total Size|(GB)' format 9,999.00

column free_gb Heading 'Avail Space|(GB)' format 9,999.00

column state Heading 'State' format A10;

column type Heading 'Type' format A12;

SELECT group_number,

name,

total_mb/1024 total_gb, free_mb/1024 free_gb, state,

type

FROM v$asm_diskgroup

ORDER by 1,2;

WI – Linux Database Creation Process 11.2.0.x.x on Oracle ASM 1


6
Appendix B – Default Configuration

• Database Parameters

File Location Variables Value


Oracle Database files {+DG1}
Flash Recovery Area {+FRA1}

Options Yes/No Associated tablespace


Oracle Data Mining No SYSAUX
Oracle Text No SYSAUX
Oracle OLAP No SYSAUX
Oracle Spatial No SYSAUX
Oracle Ultra Search No SYSAUX
Oracle Label Security No SYSTEM
Example Schemas No SYSAUX
Enterprise Manager Repository No SYSAUX

Character Sets Value


<Character Set e.g.
Database Character Set
AL32UTF8>
National Character Set AL16UTF16

TABLESPACE TABLE
Segment Space Extent Allocation Uniform
Tablespace Name Type
Management Management Type Size
AUDIT_DATA Permanent Auto Local Autoallocate
SYSTEM Permanent Auto Local Autoallocate
SYSAUX Permanent Auto Local Autoallocate
TEMP Temporary Auto Local Autoallocate
TOOLS Permanent Auto Local Autoallocate
USERS Permanent Auto Local Autoallocate
UNDOTBS1 Undo Auto Local Autoallocate

DATAFILES TABLE
Tablespace
Datafile Name Size (M)
Name
{+DG1}/<SID>/DATAFILES/audit_data_%.dbf AUDIT_DATA 1000
{+DG1}/<SID>/DATAFILES/system_%.dbf SYSTEM 1500
{+DG1}/<SID>/DATAFILES//sysaux_%.dbf SYSAUX 2000
{+DG1}/<SID>/DATAFILES/temp_%1.dbf TEMP 1000
{+DG1}/<SID>/DATAFILES/tools_%1.dbf TOOLS 100
{+DG1}/<SID>/DATAFILES/users_%1.dbf USERS 100
{+DG1}/<SID>/DATAFILES/undotbs1_%1.dbf UNDOTBS1 1000

WI – Linux Database Creation Process 11.2.0.x.x on Oracle ASM 1


7
REDO LOGS
TABLE
Redo File Name Redo File Path Group Member Size (M)
group_1.%.% {+DG1} 1 1 100
group_1.%.% {+FRA1} 1 2 100
group_2.%.% {+DG1} 2 1 100
group_2.%.% {+FRA1} 2 2 100
group_3.%.% {+DG1} 3 1 100
group_3.%.% {+FRA1} 3 2 100

• CreateDB.conf Parameters

######################################################################################
# Name: CreateDB.conf
# Version: 1.0
# Author: P.Scotto
# Date: 02/Dec/2013
# Description: Configuration Variables/Settings for 12.1
# Dependencies: None
# Parameters: N/A
#
# Revisions:
#
# Ver Date Author Description
# --------- ---------- --------------- -----------------------
# 1.0 02/Dec/2013 P.Scotto 1. created file
# 1.0 06/Jan/2014 P.Scotto 1. Made PLUGGABLE default "NO"
# 1.0 03/Mar/2014 P.Scotto 1. Made default version 12.1.0.1.2
#
#######################################################################################

# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Environment Settings:
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
export PLUGGABLE="NO"
#export PLUGGABLE="YES"
export ORACLE_USER="`id -un`"
export ORACLE_SID="${ORACLE_SID}"
export ORACLE_BASE="/opt/oracle/${ORACLE_USER}"
export ORACLE_VER="12.1.0.1"
# PSU0: Nov 2013
# PSU2: Jan 2014
export ORACLE_PSU="2"
export ORACLE_HOME="${ORACLE_BASE}/product/${ORACLE_VER}.${ORACLE_PSU}"
export PERL5LIB=${ORACLE_HOME}/rdbms/admin:${PERL5LIB}

# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Physical Database Settings:
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

# ASM DISK Groups:


export DG_DATA_01="+DG1"
export DG_FRA_01="+FRA1"
export DG_FRA_01_SIZE="60G"

# Create DB Parameters:
export MAXDF="1024"
export MAXINST="8"
export MAXLF="100"
export MAXLM="2"
export MAXLH="1800"
WI – Linux Database Creation Process 11.2.0.x.x on Oracle ASM 20
# Tablespace Sizes:
export SIZEAUX="2000M"
export SIZESYS="1500M"
export SIZEUNDO="1000M"
export SIZETEMP="1000M"
export SIZEUSERS="100M"
export SIZETOOLS="100M"
export SIZEAUDIT="1000M"

# Redo Log Sizes:


export SIZEREDO="100M"

# SYS/SYSTEM Password
export DBPWD="manager"

# Character Set Settings:


export CHARACTER_SET="AL32UTF8"
export NATIONAL_CHARACTER_SET="AL16UTF16"

# Archive Logging (TRUE|FALSE)


export ARCHIVE_LOGGING=TRUE

# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Init.ora Settings:
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

export memory_target="1520M"
export compatible="12.1.0"
export db_block_size="8192"
export db_file_multiblock_read_count="16"
export db_files="1024"
export db_block_checking="FALSE"
export db_block_checksum="TRUE"

# Range of values (BYTE|CHAR)


export nls_length_semantics="BYTE”

WI – Linux Database Creation Process 11.2.0.x.x on Oracle ASM 21


WI – Linux Database Creation Process 11.2.0.x.x on Oracle ASM 22