Tuesday, June 14, 2022

Manual Database Creation Or Silent Mode Database Creation

Manual Database Creation Or Silent Mode Database Creation


High Level steps:

1. set the environmental variable:
2. create dummy init or pfile:
3. create database:
4. create listener.ora
5. create tnsnames.ora
6. create password file:

set the environmental variable:

vi db.env

#!/bin/sh
umask 0022
export ORACLE_SID=DEVDB
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/19.0.0.0/dbhome_1
export LD_LIBRARY_PATH=$ORACLE_HOME/lib
export CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib
export PATH=$PATH:$ORACLE_HOME/bin

$. db.env
$env |grep ORA

create dummy init or pfile:

cd $ORACLE_HOME/dbs

$ vi initDEVDB.ora
*.audit_file_dest='/u01/app/oracle/admin/DEVDB/adump'
*.audit_trail='db'
*.compatible='19.0.0'
*.control_files='/u01/app/oracle/oradata/DEVDB/controlfile/control01.ctl' '/u01/app/oracle/fast_recovery_area/DEVDB/controlfile/control02.ctl'
*.db_block_size=8192
*.db_domain=''
*.db_recovery_file_dest='/u01/app/oracle/fast_recovery_area'
*.db_recovery_file_dest_size=10G
*.db_name='DEVDB'
*.db_unique_name='DEVDB'
*.diagnostic_dest='/u01/app/oracle'
*.dispatchers='(PROTOCOL=TCP) (SERVICE=DBATEAMXDB)'
*.log_archive_format='%t_%s_%r.arc'
#*.db_create_file_dest='/u01/app/oracle/oradata'
#*.nls_language='AMERICAN'
#*.nls_territory='AMERICA'
*.open_cursors=300
*.pga_aggregate_target=1GB
*.processes=150
*.remote_login_passwordfile='EXCLUSIVE'
*.sga_target=2GB
*.undo_tablespace='UNDOTBS1'

SQL > sqlplus / as sysdba

SQL*Plus: Release 11.1.0.2.0 Production on Mon Jul 20 11:19:05 2015
Copyright (c) 1982, 2013, Oracle.  All rights reserved.
Connected to an idle instance.
 
SQL > startup nomount
ORACLE instance started.
Total System Global Area 1603411968 bytes
Fixed Size                  2228784 bytes
Variable Size             503320016 bytes
Database Buffers         1073741824 bytes
Redo Buffers               24121344 bytes
SQL >

create database:

CREATE DATABASE DEVDB
MAXLOGFILES 5
MAXLOGMEMBERS 5
MAXDATAFILES 100
MAXINSTANCES 1
LOGFILE
GROUP 1 '/u01/app/oracle/oradata/DEVDB/onlinelog/redo1.log' SIZE 100M,
GROUP 2 '/u01/app/oracle/oradata/DEVDB/onlinelog/redo2.log' SIZE 100M,
GROUP 3 '/u01/app/oracle/oradata/DEVDB/onlinelog/redo3.log' SIZE 100M
DATAFILE
'/u01/app/oracle/oradata/DEVDB/datafile/system.dbf' size 300M REUSE AUTOEXTEND ON
sysaux datafile '/u01/app/oracle/oradata/DEVDB/datafile/sysaux.dbf' size 200m
undo tablespace UNDOTBS1 datafile '/u01/app/oracle/oradata/DEVDB/datafile/undo1.dbf' size 200m
DEFAULT TEMPORARY TABLESPACE temp
TEMPFILE '/u01/app/oracle/oradata/DEVDB/datafile/temp01.dbf' SIZE 100M REUSE
CHARACTER SET AL32UTF8;


catalog.sql creates all the data dictionary views
catproc.sql creates system specified stored procedures
pupbld.sql creates the default roles and profiles

sqlplus / as sysdba
SQL > @$ORACLE_HOME/rdbms/admin/catalog.sql
SQL > @$ORACLE_HOME/rdbms/admin/catproc.sql

SQL > conn system/manager
SQL > @$ORACLE_HOME/sqlplus/admin/pupbld.sql

Default Password For System User("manager") Has Changed In Oracle 19c (Doc ID 2620296.1)
alter user system identified by Mallik123#;

create listener.ora

cd $ORACLE_HOME/network/admin 
vi listener.ora
LISTENER_DEVDB =
    (DESCRIPTION=
      (ADDRESS=(PROTOCOL=TCP)(HOST=oraclelab1.localdomain.com)(PORT=1521))
    )
 
ADR_BASE_LISTENER_DEVDB = /u01/app/oracle

 
lsnrctl start LISTENER_DEVDB

create tnsnames.ora

cd $ORACLE_HOME/network/admin 
vi tnsnames.ora
DEVDB =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = oraclelab1.localdomain.com)(PORT = 1521))
    )
    (CONNECT_DATA =
      (SERVICE_NAME = DEVDB)
    )
  )

create password file:

cd $ORACLE_HOME/dbs
orapwd file=$ORACLE_HOME/dbs/orapwDEVDB password=Mallik123# entries=5

logs:

[oracle@oraclelab1 ~]$ cat db.env
#!/bin/sh
umask 0022
export ORACLE_SID=DEVDB
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/19.0.0.0/dbhome_1
export LD_LIBRARY_PATH=$ORACLE_HOME/lib
export CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib
export PATH=$PATH:$ORACLE_HOME/bin
[oracle@oraclelab1 ~]$
[oracle@oraclelab1 ~]$ . db.env
[oracle@oraclelab1 ~]$
[oracle@oraclelab1 ~]$ env |grep ORA
ORACLE_SID=DEVDB
ORACLE_BASE=/u01/app/oracle
ORACLE_HOME=/u01/app/oracle/product/19.0.0.0/dbhome_1
[oracle@oraclelab1 ~]$

[oracle@oraclelab1 ~]$ cd $ORACLE_HOME/dbs
[oracle@oraclelab1 dbs]$ cat initDEVDB.ora
*.audit_file_dest='/u01/app/oracle/admin/DEVDB/adump'
*.audit_trail='db'
*.compatible='19.0.0'
*.control_files='/u01/app/oracle/oradata/DEVDB/controlfile/control01.ctl' '/u01/app/oracle/fast_recovery_area/DEVDB/controlfile/control02.ctl'
*.db_block_size=8192
*.db_domain=''
*.db_recovery_file_dest='/u01/app/oracle/fast_recovery_area'
*.db_recovery_file_dest_size=10G
*.db_name='DEVDB'
*.db_unique_name='DEVDB'
*.diagnostic_dest='/u01/app/oracle'
*.dispatchers='(PROTOCOL=TCP) (SERVICE=DBATEAMXDB)'
*.log_archive_format='%t_%s_%r.arc'
#*.db_create_file_dest='/u01/app/oracle/oradata'
#*.nls_language='AMERICAN'
#*.nls_territory='AMERICA'
*.open_cursors=300
*.pga_aggregate_target=1G
*.processes=150
*.remote_login_passwordfile='EXCLUSIVE'
*.sga_target=2G
*.undo_tablespace='UNDOTBS1'
[oracle@oraclelab1 dbs]$

[oracle@oraclelab1 dbs]$ sqlplus / as sysdba

SQL*Plus: Release 19.0.0.0.0 - Production on Tue Jun 14 22:17:35 2022
Version 19.3.0.0.0

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

Connected to an idle instance.

SQL> startup nomount
ORACLE instance started.

Total System Global Area 2147481656 bytes
Fixed Size                  8898616 bytes
Variable Size             486539264 bytes
Database Buffers         1644167168 bytes
Redo Buffers                7876608 bytes
SQL>
SQL> CREATE DATABASE DEVDB
MAXLOGFILES 5
MAXLOGMEMBERS 5
MAXDATAFILES 100
  2    3    4    5  MAXINSTANCES 1
  6  LOGFILE
  7  GROUP 1 '/u01/app/oracle/oradata/DEVDB/onlinelog/redo1.log' SIZE 100M,
GROUP 2 '/u01/app/oracle/oradata/DEVDB/onlinelog/redo2.log' SIZE 100M,
  8    9  GROUP 3 '/u01/app/oracle/oradata/DEVDB/onlinelog/redo3.log' SIZE 100M
 10  DATAFILE
'/u01/app/oracle/oradata/DEVDB/datafile/system.dbf' size 300M REUSE AUTOEXTEND ON
 11   12  sysaux datafile '/u01/app/oracle/oradata/DEVDB/datafile/sysaux.dbf' size 200m
 13  undo tablespace UNDOTBS1 datafile '/u01/app/oracle/oradata/DEVDB/datafile/undo1.dbf' size 200m
DEFAULT TEMPORARY TABLESPACE temp
 14   15  TEMPFILE '/u01/app/oracle/oradata/DEVDB/datafile/temp01.dbf' SIZE 100M REUSE
 16  CHARACTER SET AL32UTF8;

Database created.

SQL>

SQL> @$ORACLE_HOME/rdbms/admin/catalog.sql
Synonym created.
Grant succeeded.
View created.
..................

SQL> @$ORACLE_HOME/rdbms/admin/catproc.sql
Synonym created.
Grant succeeded.
View created.
..................

SQL> alter user system identified by Mallik123#;

User altered.

SQL> conn system/Mallik123#
Connected.
SQL> show user
USER is "SYSTEM"
SQL>
SQL> @$ORACLE_HOME/sqlplus/admin/pupbld.sql
SQL> DROP SYNONYM PRODUCT_USER_PROFILE;
DROP SYNONYM PRODUCT_USER_PROFILE
..................

[oracle@oraclelab1 dbs]$ cd $ORACLE_HOME/network/admin
[oracle@oraclelab1 admin]$ cat listener.ora
LISTENER_DEVDB =
    (DESCRIPTION=
      (ADDRESS=(PROTOCOL=TCP)(HOST=oraclelab1.localdomain.com)(PORT=1521))
    )

ADR_BASE_LISTENER_DEVDB = /u01/app/oracle
[oracle@oraclelab1 admin]$

[oracle@oraclelab1 admin]$ lsnrctl status LISTENER_DEVDB

LSNRCTL for Linux: Version 19.0.0.0.0 - Production on 14-JUN-2022 23:05:18

Copyright (c) 1991, 2019, Oracle.  All rights reserved.

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=oraclelab1.localdomain.com)(PORT=1521)))
TNS-12541: TNS:no listener
 TNS-12560: TNS:protocol adapter error
  TNS-00511: No listener
   Linux Error: 111: Connection refused
[oracle@oraclelab1 admin]$
[oracle@oraclelab1 admin]$ lsnrctl start LISTENER_DEVDB

LSNRCTL for Linux: Version 19.0.0.0.0 - Production on 14-JUN-2022 23:05:25

Copyright (c) 1991, 2019, Oracle.  All rights reserved.

Starting /u01/app/oracle/product/19.0.0.0/dbhome_1/bin/tnslsnr: please wait...

TNSLSNR for Linux: Version 19.0.0.0.0 - Production
System parameter file is /u01/app/oracle/product/19.0.0.0/dbhome_1/network/admin/listener.ora
Log messages written to /u01/app/oracle/diag/tnslsnr/oraclelab1/listener_devdb/alert/log.xml
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=oraclelab1.localdomain.com)(PORT=1521)))

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=oraclelab1.localdomain.com)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER_DEVDB
Version                   TNSLSNR for Linux: Version 19.0.0.0.0 - Production
Start Date                14-JUN-2022 23:05:25
Uptime                    0 days 0 hr. 0 min. 0 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /u01/app/oracle/product/19.0.0.0/dbhome_1/network/admin/listener.ora
Listener Log File         /u01/app/oracle/diag/tnslsnr/oraclelab1/listener_devdb/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=oraclelab1.localdomain.com)(PORT=1521)))
The listener supports no services
The command completed successfully
[oracle@oraclelab1 admin]$
[oracle@oraclelab1 admin]$ lsnrctl status LISTENER_DEVDB

LSNRCTL for Linux: Version 19.0.0.0.0 - Production on 14-JUN-2022 23:05:28

Copyright (c) 1991, 2019, Oracle.  All rights reserved.

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=oraclelab1.localdomain.com)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER_DEVDB
Version                   TNSLSNR for Linux: Version 19.0.0.0.0 - Production
Start Date                14-JUN-2022 23:05:25
Uptime                    0 days 0 hr. 0 min. 2 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /u01/app/oracle/product/19.0.0.0/dbhome_1/network/admin/listener.ora
Listener Log File         /u01/app/oracle/diag/tnslsnr/oraclelab1/listener_devdb/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=oraclelab1.localdomain.com)(PORT=1521)))
The listener supports no services
The command completed successfully
[oracle@oraclelab1 admin]$

[oracle@oraclelab1 admin]$ cat tnsnames.ora
DEVDB =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = oraclelab1.localdomain.com)(PORT = 1521))
    )
    (CONNECT_DATA =
      (SERVICE_NAME = DEVDB)
    )
  )
[oracle@oraclelab1 admin]$
[oracle@oraclelab1 admin]$ tnsping DEVDB

TNS Ping Utility for Linux: Version 19.0.0.0.0 - Production on 14-JUN-2022 23:05:49

Copyright (c) 1997, 2019, Oracle.  All rights reserved.

Used parameter files:


Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = oraclelab1.localdomain.com)(PORT = 1521))) (CONNECT_DATA = (SERVICE_NAME = DEVDB)))
OK (0 msec)
[oracle@oraclelab1 admin]$

[oracle@oraclelab1 admin]$ cd $ORACLE_HOME/dbs
[oracle@oraclelab1 dbs]$ orapwd file=$ORACLE_HOME/dbs/orapwDEVDB password=Mallik123# entries=5
[oracle@oraclelab1 dbs]$

[oracle@oraclelab1 dbs]$ lsnrctl status LISTENER_DEVDB

LSNRCTL for Linux: Version 19.0.0.0.0 - Production on 14-JUN-2022 23:08:01

Copyright (c) 1991, 2019, Oracle.  All rights reserved.

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=oraclelab1.localdomain.com)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER_DEVDB
Version                   TNSLSNR for Linux: Version 19.0.0.0.0 - Production
Start Date                14-JUN-2022 23:05:25
Uptime                    0 days 0 hr. 2 min. 36 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /u01/app/oracle/product/19.0.0.0/dbhome_1/network/admin/listener.ora
Listener Log File         /u01/app/oracle/diag/tnslsnr/oraclelab1/listener_devdb/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=oraclelab1.localdomain.com)(PORT=1521)))
Services Summary...
Service "DBATEAMXDB" has 1 instance(s).
  Instance "DEVDB", status READY, has 1 handler(s) for this service...
Service "DEVDB" has 1 instance(s).
  Instance "DEVDB", status READY, has 1 handler(s) for this service...
The command completed successfully
[oracle@oraclelab1 dbs]$
[oracle@oraclelab1 dbs]$ sqlplus sys/Mallik123#@DEVDB as sysdba

SQL*Plus: Release 19.0.0.0.0 - Production on Tue Jun 14 23:08:16 2022
Version 19.3.0.0.0

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


Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.3.0.0.0

SQL> show user
USER is "SYS"
SQL>

Regards,
Mallik

No comments:

Post a Comment

Automation Script | Archivelog Generation Hourly Monitoring

1. List out all the running databases and pic one database where we want to monitore the archive log generation from last 1 month. [oracle@o...