Create the password file:
orapwd file=$ORACLE_HOME/dbs/orapw<SID>.ora entries=30
A new password file will be created which will be able to store 30 users. You will be prompted to enter the password for the SYS account.
IGNORECASE:
If ignorecase=Y, passwords will be treated as case insensitive.
V$PWFILE_USERS
contains a list of all users which exist in the password file. This can be handy if you need to recreate the password file
(.e.g. when you reached the ENTRIES limit (“file is full” error message), or when REMOTE_LOGIN_PASSWORDFILE is set to NONE or SHARED,
and you need to change it (in this case you would need to recreate the password file, because you can only change it when REMOTE_LOGIN_PASSWORDFILE is set to EXCLUSIVE).
REMOTE_LOGIN_PASSWORDFILE (you need to restart the database in order to change this parameter):
- NONE: no privileged connections are allowed over nonsecure connections.
- EXCLUSIVE (default): can be use by only 1 instance
- SHARED: can be used by multiple instances (handy for RAC)/databases running on the same server.
Adding a user to the password file can be done by granting either the SYSDBA or SYSDBA privilege::
grant SYSDBA to new_user;
grant SYSOPER to new_user;
Set the required environment variables.
export ORACLE_SID=mynewdb
export ORACLE_HOME=/u01/oracle/product/11.2.0/db_1
export PATH=$ORACLE_HOME/bin:$PATH
Create the initialization parameter file.
You can use the sample init parameter file to start from: $ORACLE_HOME/dbs/init.ora
Copy the sample init parameter file to init<SID>.ora and change the contents to your liking:
cd $ORACLE_HOME/dbs
cp init.ora init<SID>.ora
As a minimum, you should specify the following parameters:
db_name=ocmdb1
control_files = (/u01/oradata/ocmdb1/control1.ctl, /u02/oradata/ocmdb1/control2.ctl, /u03/oradata/ocmdb1/control3.ctl)
memory_target=1G
Example of the contents:
db_name='ocmdb1'
memory_target=1G
processes = 150
db_block_size=8192
db_recovery_file_dest='/u03/oradata/ocmdb1/flash_recovery_area'
db_recovery_file_dest_size=2G
diagnostic_dest='/u01/app/oracle'
open_cursors=300
remote_login_passwordfile='EXCLUSIVE'
undo_tablespace='UNDOTBS'
control_files = (/u01/oradata/ocmdb1/control1.ora, /u02/oradata/ocmdb1/control2.ora, /u03/oradata/ocmdb1/control3.ora)
compatible ='11.2.0'
Create an spfile:
export ORACLE_SID=ocmdb1
SQLPLUS /nolog
CONNECT SYS/password AS SYSDBA
create spfile from pfile;
exit;
Startup in nomount in order to create the database:
sqlplus / as sysdba
startup nomount
(ORA-00845: MEMORY_TARGET not supported on this system
-> I received this error because I dedicated more memory to memory_target than available. Decreasing the memory_target solved the issue)
Issue the CREATE DATABASE statement:
(All directories for the datafiles/ redo logs must already exist…)
CREATE DATABASE ocmdb1
USER SYS IDENTIFIED BY sys_password
USER SYSTEM IDENTIFIED BY system_password
LOGFILE GROUP 1 ('/u01/oradata/ocmdb1/redo01a.log','/u02/oradata/ocmdb1/redo01b.log') SIZE 100M BLOCKSIZE 512,
GROUP 2 ('/u01/oradata/ocmdb1/redo02a.log','/u02/oradata/ocmdb1/redo02b.log') SIZE 100M BLOCKSIZE 512,
GROUP 3 ('/u01/oradata/ocmdb1/redo03a.log','/u02/oradata/ocmdb1/redo03b.log') SIZE 100M BLOCKSIZE 512
MAXLOGFILES 5
MAXLOGMEMBERS 5
MAXLOGHISTORY 1
MAXDATAFILES 100
CHARACTER SET AL32UTF8
NATIONAL CHARACTER SET AL16UTF16
EXTENT MANAGEMENT LOCAL
DATAFILE '/u02/oradata/ocmdb1/system01.dbf' SIZE 325M REUSE
SYSAUX DATAFILE '/u02/oradata/ocmdb1/sysaux01.dbf' SIZE 325M REUSE
DEFAULT TABLESPACE users
DATAFILE '/u02/oradata/ocmdb1/users01.dbf'
SIZE 500M REUSE AUTOEXTEND ON MAXSIZE UNLIMITED
DEFAULT TEMPORARY TABLESPACE tempts1
TEMPFILE '/u02/oradata/ocmdb1/temp01.dbf'
SIZE 20M REUSE
UNDO TABLESPACE undotbs
DATAFILE '/u02/oradata/ocmdb1/undotbs01.dbf'
SIZE 200M REUSE AUTOEXTEND ON MAXSIZE UNLIMITED;
Example using OMF (Oracle Managed Files):
Add the following in your init file:
DB_CREATE_FILE_DEST='/u02/oradata/ocmdb1'
=> All the locations for the tablespaces and redo logs will be derived from this parameter.
In the following example, default sizes are used for the tablespaces and redo logs:
CREATE DATABASE mynewdb
USER SYS IDENTIFIED BY sys_password
USER SYSTEM IDENTIFIED BY system_password
EXTENT MANAGEMENT LOCAL
DEFAULT TEMPORARY TABLESPACE temp
UNDO TABLESPACE undotbs1
DEFAULT TABLESPACE users;
Run the following scripts as sys:
sqlplus / as sysdba
spool cat.out
@?/rdbms/admin/catalog.sql
@?/rdbms/admin/catproc.sql
@?/sqlplus/admin/pupbld.sql
Create the listener.ora and tnsnames.ora file manually (or use netca if allowed…):
You can find a sample listener.ora and tnsnames.ora file in $ORACLE_HOME/network/admin/samples.
cd $ORACLE_HOME/network/admin
cp samples/listener.ora .
cp samples/tnsnames.ora .
Modify these files.
Example of tnsnames.ora:
See the Net Services Administration Guide.
OCMDB1= (DESCRIPTION_LIST = # Optional depending on whether u have
# one or more descriptions
# If there is just one description, unnecessary ]
(DESCRIPTION=
(ADDRESS_LIST= # Optional depending on whether u have
# one or more addresses
# If there is just one address, unnecessary ]
(ADDRESS=
(PROTOCOL=tcp)
(HOST=ORAVM1.local)
(PORT=1521)
)
) # Optional depending on whether ADDRESS_LIST is used or not
(CONNECT_DATA=
(SERVICE_NAME=ocmdb1)
)
)
) # Optional depending on whether DESCRIPTION_LIST is used or not
Example of listener.ora:
See the Net Services Administration Guide.
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = ORAVM1.local)(PORT = 1521))
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
)
)
ADR_BASE_LISTENER = /u01/app/oracle
Geen opmerkingen:
Een reactie posten