Sunday, July 20, 2014

Manual Database creation in ASM file system

Manual Database creation steps as below.

1-Create environment files on all nodes for all instances..
(target instance name will be normally <sourceinstance_name>n,where n=1,2,.. Node of nodes)

oracle@Rac1[joshi1]> echo $ORACLE_SID
joshi1
oracle@Rac1[joshi1]> echo $ORACLE_HOME
/prod/product/oracle/11.2.0


2- a- Verify exist RAC recource detail.
        crs_stat -t
      
Rac1[oracle]_+ASM1> crs_stat -t
Name           Type           Target    State     Host
------------------------------------------------------------
ora.ARCH.dg    ora....up.type ONLINE    ONLINE    host...b020
ora.DATA.dg    ora....up.type ONLINE    ONLINE    host...b020
ora....ER.lsnr ora....er.type ONLINE    ONLINE    host...b020
ora....N1.lsnr ora....er.type ONLINE    ONLINE    host...b021
ora....N2.lsnr ora....er.type ONLINE    ONLINE    host...b020
ora....N3.lsnr ora....er.type ONLINE    ONLINE    host...b020
ora....C1.lsnr ora....er.type ONLINE    ONLINE    host...b020
ora....VOTE.dg ora....up.type ONLINE    ONLINE    host...b020
ora.asm        ora.asm.type   ONLINE    ONLINE    host...b020
ora....SM1.asm application    ONLINE    ONLINE    host...b020
ora....20.lsnr application    ONLINE    ONLINE    host...b020
ora....20.lsnr application    ONLINE    ONLINE    host...b020
ora....020.gsd application    OFFLINE   OFFLINE
ora....020.ons application    ONLINE    ONLINE    host...b020
ora....020.vip ora....t1.type ONLINE    ONLINE    host...b020
ora....SM2.asm application    ONLINE    ONLINE    host...b021
ora....21.lsnr application    ONLINE    ONLINE    host...b021
ora....21.lsnr application    ONLINE    ONLINE    host...b021
ora....021.gsd application    OFFLINE   OFFLINE
ora....021.ons application    ONLINE    ONLINE    host...b021
ora....021.vip ora....t1.type ONLINE    ONLINE    host...b021
ora.cvu        ora.cvu.type   ONLINE    ONLINE    host...b020
ora.gsd        ora.gsd.type   OFFLINE   OFFLINE
ora....network ora....rk.type ONLINE    ONLINE    host...b020
ora.oc4j       ora.oc4j.type  ONLINE    ONLINE    host...b020
ora.ons        ora.ons.type   ONLINE    ONLINE    host...b020
ora.scan1.vip  ora....ip.type ONLINE    ONLINE    host...b021
ora.scan2.vip  ora....ip.type ONLINE    ONLINE    host...b020
ora.scan3.vip  ora....ip.type ONLINE    ONLINE    host...b020
ora....arc1.db ora....se.type ONLINE    ONLINE    host...b020
       
   b- check the avilable node name for this cluster.
      olsnodes -n -i -s
   
Rac1[oracle]_+ASM1> olsnodes -n -i -s
Rac1    1       Rac1-vip        Active
Rac2    2       Rac2-vip        Active
   
3-Verify and make sure we are entho space on asm diskgroup.
Rac1[oracle]_+ASM1> asmcmd
ASMCMD> lsdg
State    Type    Rebal  Sector  Block       AU  Total_MB  Free_MB  Req_mir_free_MB  Usable_file_MB  Offline_disks  Voting_files  Name
MOUNTED  EXTERN  N         512   4096  1048576     65542    65275                0           65275              0             N  ARCH/
MOUNTED  EXTERN  N         512   4096  1048576    131084    80266                0           80266              0             N  DATA/
MOUNTED  EXTERN  N         512   4096  1048576     17408    17012                0           17012              0             Y  OCR_VOTE/


4-Create the directories specified in environment file on all nodes and for diagnostic_dest and audit_file_dest

5-Set environment to target instance on primary node -- from here we are going to start creating DB.

6-Copy the pfile from  anyof db to the  node, and update value for below database. 
 -Initialization parameter file
db_block_size=8192
cluster_database_instances=2
open_cursors=300
db_name=joshi
db_create_file_dest=+DATA
db_recovery_file_dest_size=2147483648
diagnostic_dest=/data01/app/oracle
processes=500
sga_target=3G
audit_file_dest=/data01/app/oracle/admin/joshi/adump
audit_trail=db
pga_aggregate_target=100M
undo_tablespace=UNDOTBS1
log_archive_dest=+ARCH
db_unique_name=joshi
--Need to change below parameter as per Env.
---diagnostic_dest=---
--audit_file_dest=---
--control_files=+DATA,+DATA 
---log_archive_dest=+ARCH
---db_create_file_dest='+DATA'
-----Above db_unique_name is Very importemnet parameter ASM will create file inside root of data Diskgroup , Carefully setup this parametere value .
7-Start the instance to nomount state
oracle@Rac1[joshi1]> sqlplus "/as sysdba"

SQL*Plus: Release 11.2.0.3.0 Production on Sun Jul 20 13:50:28 2014

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

Connected to an idle instance.


SQL*Plus tells us that connected to an idle instance. That means that it is not yet started.
So, lets start the instance. .
SQL> startup nomount
ORACLE instance started.

Total System Global Area 3206836224 bytes
Fixed Size                  2232640 bytes
Variable Size             654315200 bytes
Database Buffers         2499805184 bytes
Redo Buffers               50483200 bytes


CREATE DATABASE joshi
MAXINSTANCES 32
MAXLOGHISTORY 1
MAXLOGFILES 192
MAXLOGMEMBERS 3
MAXDATAFILES 1024
DATAFILE SIZE 300M AUTOEXTEND ON NEXT  1024M MAXSIZE UNLIMITED
EXTENT MANAGEMENT LOCAL
SYSAUX DATAFILE SIZE 120M AUTOEXTEND ON NEXT  1024M MAXSIZE UNLIMITED
SMALLFILE DEFAULT TEMPORARY TABLESPACE TEMP TEMPFILE SIZE 20M AUTOEXTEND ON NEXT  640K MAXSIZE UNLIMITED
SMALLFILE UNDO TABLESPACE "UNDOTBS1" DATAFILE SIZE 200M AUTOEXTEND ON NEXT  5120K MAXSIZE UNLIMITED
DEFAULT TABLESPACE USERS DATAFILE SIZE 100M
CHARACTER SET UTF8
LOGFILE GROUP 1  SIZE 500M,
GROUP 2  SIZE 500M

 -- If something goes wrong with the creation, Oracle will write an error into the alert log.
8. Adding  CONTROL_FILES location in pfile.

set linesize 2048;
column ctl_files NEW_VALUE ctl_files;
select concat('control_files=''', concat(replace(value, ', ', ''','''), '''')) ctl_files from v$parameter where name ='control_files';
control_files='+DATA/joshi/controlfile/current.302.853422869'

9-Now lets run below script for creating data dictnery tables.

@?/rdbms/admin/catalog.sql
@?/rdbms/admin/catblock.sql
@?/rdbms/admin/catproc.sql

 Run following script as SYSTEM user.

connect system/manager
@?/sqlplus/admin/pupbld.sql
@?/sqlplus/admin/help/hlpbld.sql helpus.sql

!wow here we created DB on ASM file system .

No comments:

Post a Comment

How to create user in MY SQL

Create  a new MySQL user Account mysql > CREATE USER ' newuser '@'localhost' IDENTIFIED BY ' password '...