How to create database manually in oracle 11g R2
step.1.go to the cat /etc/oratab and edit it.
vi /etc/oratab
pankaj:/u01/app/oracle/product/11.2.0/dbhome_1:N
step.2.login to oracle user
[oracle@servera ~]$ . oraenv
ORACLE_SID = [orcl] ? pankaj
The Oracle base for ORACLE_HOME=/u01/app/oracle/product/11.2.0/dbhome_1 is /u01/app/oracle
note:-. oraenv command hit for oratab and pankaj is name of the database.
step.3.copy pfile
cd /u01/app/oracle/product/11.2.0/dbhome_1/dbs
[oracle@servera dbs]$ cp initorcl.ora initpankaj.ora
step.4.edit pfile
current pfile
orcl.__db_cache_size=289406976
orcl.__java_pool_size=4194304
orcl.__large_pool_size=4194304
orcl.__oracle_base='/u01/app/oracle'#ORACLE_BASE set from environment
orcl.__pga_aggregate_target=310378496
orcl.__sga_target=457179136
orcl.__shared_io_pool_size=0
orcl.__shared_pool_size=150994944
orcl.__streams_pool_size=0
*.audit_file_dest='/u01/app/oracle/admin/orcl/adump'
*.audit_trail='db'
*.compatible='11.2.0.0.0'
*.control_files='/u01/app/oracle/oradata/orcl/control01.ctl','/u01/app/oracle/flash_recovery_area/orcl/control02.ctl'
*.db_block_size=8192
*.db_domain=''
*.db_name='orcl'
*.db_recovery_file_dest='/u01/app/oracle/flash_recovery_area'
*.db_recovery_file_dest_size=4070572032
*.diagnostic_dest='/u01/app/oracle'
*.dispatchers='(PROTOCOL=TCP) (SERVICE=orclXDB)'
*.memory_target=765460480
*.open_cursors=300
*.processes=150
*.remote_login_passwordfile='EXCLUSIVE'
*.undo_tablespace='UNDOTBS1'
after some change pfile
orcl.__db_cache_size=289406976
orcl.__java_pool_size=4194304
orcl.__large_pool_size=4194304
orcl.__oracle_base='/u03/app/oracle'#ORACLE_BASE set from environment
orcl.__pga_aggregate_target=310378496
orcl.__sga_target=457179136
orcl.__shared_io_pool_size=0
orcl.__shared_pool_size=150994944
orcl.__streams_pool_size=0
*.audit_file_dest='/u03/app/oracle/admin/pankaj/adump'
*.audit_trail='db'
*.compatible='11.2.0.0.0'
*.control_files='/u03/app/oracle/oradata/pankaj/control01.ctl','/u03/app/oracle/flash_recovery_area/pankaj/control02.ctl'
*.db_block_size=8192
*.db_domain=''
*.db_name='pankaj'
*.db_recovery_file_dest='/u03/app/oracle/flash_recovery_area'
*.db_recovery_file_dest_size=4070572032
*.diagnostic_dest='/u03/app/oracle'
*.dispatchers='(PROTOCOL=TCP) (SERVICE=orclXDB)'
*.memory_target=765460480
*.open_cursors=300
*.processes=150
*.remote_login_passwordfile='EXCLUSIVE'
*.undo_tablespace='UNDOTBS1'
step.5.create a directory for oracle user.
mkdir -p /u03/app/oracle/admin/pankaj/adump
mkdir -p /u03/app/oracle/oradata/pankaj
mkdir -p /u03/app/oracle/flash_recovery_area/pankaj
mkdir -p /u03/app/oracle/flash_recovery_area
mkdir -p /u03/app/oracle
step.6.change permission and change user and group for oracle user.
chown -R oracle:dba /u03/
chmod -R 775 /u03/
step.7.run this script for oracle user.
cd /u01/app/oracle/product/11.2.0/dbhome_1/dbs
export ORACLE_SID=pankaj
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/dbhome_1
export PATH=$ORACLE_HOME/bin:$PATH
step.8.create passowrd file
cd /u01/app/oracle/product/11.2.0/dbhome_1/dbs
orapwd file='/u01/app/oracle/product/11.2.0/dbhome_1/dbs/orapwpankaj' password=pankaj
step.8.login in oracle follow it.
[oracle@servera dbs]$ sqlplus
SQL*Plus: Release 11.2.0.1.0 Production on Sun Oct 13 04:34:09 2019
Copyright (c) 1982, 2009, Oracle. All rights reserved.
Enter user-name: / as sysdba
Connected to an idle instance.
SQL>startup nomount pfile='/u01/app/oracle/product/11.2.0/dbhome_1/dbs/initpankaj.ora';
SQL>create spfile from pfile;
SQL>shut immediate
step.9.create a file .sql extension
[oracle@servera u03]$ touch create_db.sql
[oracle@servera u03]$ ll
total 4
drwxrwxr-x. 3 oracle dba 19 Oct 13 04:04 app
-rw-r--r--. 1 oracle oinstall 1261 Oct 13 04:12 create_db.sql
[oracle@servera u03]$ vi create_db.sql
CREATE DATABASE pankaj
USER SYS IDENTIFIED BY oracle3
USER SYSTEM IDENTIFIED BY oracle3
LOGFILE GROUP 1 ('/u03/app/oracle/oradata/pankaj/redo01a.log','/u03/app/oracle/oradata/pankaj/redo01b.log') SIZE 50M BLOCKSIZE 512,
GROUP 2 ('/u03/app/oracle/oradata/pankaj/redo02a.log','/u03/app/oracle/oradata/pankaj/redo02b.log') SIZE 50M BLOCKSIZE 512,
GROUP 3 ('/u03/app/oracle/oradata/pankaj/redo03a.log','/u03/app/oracle/oradata/pankaj/redo03b.log') SIZE 50M BLOCKSIZE 512
MAXLOGHISTORY 1
MAXLOGFILES 16
MAXLOGMEMBERS 3
MAXDATAFILES 1024
CHARACTER SET AL32UTF8
NATIONAL CHARACTER SET AL16UTF16
EXTENT MANAGEMENT LOCAL
DATAFILE '/u03/app/oracle/oradata/pankaj/system01.dbf' SIZE 100M REUSE AUTOEXTEND ON NEXT 100K MAXSIZE UNLIMITED
SYSAUX DATAFILE '/u03/app/oracle/oradata/pankaj/sysaux01.dbf' SIZE 100M REUSE AUTOEXTEND ON NEXT 100K MAXSIZE UNLIMITED
DEFAULT TABLESPACE USERS DATAFILE '/u03/app/oracle/oradata/pankaj/users01.dbf' SIZE 50M REUSE AUTOEXTEND ON MAXSIZE UNLIMITED
DEFAULT TEMPORARY TABLESPACE TEMP TEMPFILE '/u03/app/oracle/oradata/pankaj/temp01.dbf' SIZE 20M REUSE AUTOEXTEND ON NEXT 640K MAXSIZE UNLIMITED
UNDO TABLESPACE UNDOTBS1 DATAFILE '/u03/app/oracle/oradata/pankaj/undotbs01.dbf' SIZE 20M REUSE AUTOEXTEND ON NEXT 5120K MAXSIZE UNLIMITED;
step.10. login in oracle run script
SQL*Plus: Release 11.2.0.1.0 Production on Sun Oct 13 04:34:09 2019
Copyright (c) 1982, 2009, Oracle. All rights reserved.
Enter user-name: / as sysdba
Connected to an idle instance.
SQL>startup nomount
SQL>@/u03/create_db.sql
step.11.after creating database and run this script
SQL>@?/rdbms/admin/catalog.sql
SQL>@?/rdbms/admin/catproc.sql
connect system/oracle3
@?/rdbms/admin/pupbld.sql
Comments
Post a Comment