Tuesday, May 3, 2016

Oracle Database Creation ( Using OMF )

=>> At first Goto oracle home location and check the databases available.


#

#su - oracle

$ps -eaf | grep smon

$cat /etc/oratab

$clear



=>> And Now we go for NEW Database Creation Steps.



$.  .bash_profile

$cd $ORACLE_HOME/dbs

$ls


=>> From this location, Create a Parameter File with the required database instance name:



$vi  initprod.ora

db_name = "prod"

control_files = ( /u01/app/oracle/oradata/prod/Control01.ctl, /u01/app/oracle/flash_recovery_area/Control02.ctl )

DB_CREATE_FILE_DEST = /u01/app/oracle/oradata/

DB_CREATE_ONLINE_LOG_DEST_1 = /u01/app/oracle/oradata/

DB_CREATE_ONLINE_LOG_DEST_2 = /u01/app/oracle/oradata/

DB_CREATE_ONLINE_LOG_DEST_3 = /u01/app/oracle/oradata/

DB_UNIQUE_NAME = "prod"

:wq!



=>> And Now Come to Oracle user home location.


$cd

$vi  postdb.sql

spool  post1.log
@?/rdbms/admin/catlog.sql
@?/rdbms/admin/catproc.sql
spool off

alter user system identified by manager account unlock
connect system/manager

spool post2.log
@?/sqlplus/admin/pupbld.sql
spool off


:wq!


=>> And Now Open the database in NoMount mode using Parameter File.



$export ORACLE_SID=prod

$sqlplus / as sysdba


sql>


sql>startup nomount


sql>@createdb.sql


sql>@postdb.sql



=>> And now Open the database and check the status and files:


Open another Terminal and follow these below specified commands..


[oracle@ram ~]$ export ORACLE_SID=prod
[oracle@ram ~]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.1.0 Production on Sun May 1 15:50:11 2016

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


Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL> select instance_name,status from v$instance;

INSTANCE_NAME    STATUS
---------------- ------------
prod             OPEN

SQL> select name,open_mode from v$database;

NAME      OPEN_MODE
--------- --------------------
PROD      READ WRITE

SQL> select name from v$controlfile;

NAME
--------------------------------------------------------------------------------
/u01/app/oracle/oradata/prod/control01.ctl
/u01/app/oracle/flash_recovery_area/prod/control02.ctl

SQL> select member from v$logfile;

MEMBER
--------------------------------------------------------------------------------
/u01/app/oracle/oradata/prod/redo03.log
/u01/app/oracle/oradata/prod/redo02.log
/u01/app/oracle/oradata/prod/redo01.log

SQL>     
SQL> 
SQL> 
SQL> select name from v$archived_log;

no rows selected

SQL> archive log list
Database log mode              No Archive Mode
Automatic archival             Disabled
Archive destination            USE_DB_RECOVERY_FILE_DEST
Oldest online log sequence     1
Current log sequence           2
SQL> 

















No comments:

Post a Comment