Manually create a database with the command prompt
With an instance of Oracle currently running on the server, we can manually create a database.
In this scenario we are connected to the system as an Oracle user with the first instance active. The first step is to decide on a name for the instance to be created.
|
1 2 3 |
$set ORACLE_SID=cargo $export ORACLE_SID=cargo |
Create a pfile called initcargo.orcl in the “/u01/app/oracle/product/10.2.0/db_1/dbs” path.
Configure the paths according to your requirements.
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
*.db_name='cargo' *.db_block_size=8192 *.sga_target=231735296 *.undo_management='AUTO' *.control_files='/u01/app/oracle/oradata/cargo/control01.ctl' *.user_dump_dest='/u01/app/oracle/admin/cargo/udump' *.background_dump_dest='/u01/app/oracle/admin/cargo/bdump' *.core_dump_dest='/u01/app/oracle/admin/cargo/cdump' |
It’s necessary to create all of these folders and grant them the needed rights. If you haven’t already created an Oracle user:
|
1 2 3 4 5 |
chown oracle:oinstall initcargo.ora this command changes the ownership chmod g+w initcargo.ora giving write rights to the oinstall group CREATE SPFILE FROM PFILE='/u01/app/oracle/product/10.2.0/db_1/dbs/initcargo.ora'; |
Opening the database in nomount mode and creating an spfile.
|
1 |
startup nomount; |
|
1 |
ORA-09925: Unable to create audit trail file Linux Error: 2: No such file or directory Additional information: 9925 |
If you get an error such as this one, there may be a problem with rights and/or paths.
By using the create database command we create the listed files:
– Redo Log files
– system.dbf and sysaux.dbf (files for SYSTEM tablespace)
– undo01.dbf file (for UNDO tablespace)
– temp_tbs.dbf file (for TEMPORARY tablespace)
– users.dbf (for DEFAULT PERMANENT tablespace)
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
CREATE DATABASE cargo USER SYS IDENTIFIED BY cargo USER SYSTEM IDENTIFIED BY cargo LOGFILE GROUP 1 ('/u01/app/oracle/oradata/cargo/redo01.log') SIZE 50 m, GROUP 2 ('/u01/app/oracle/oradata/kargo/redo02.log') SIZE 50 m, GROUP 3 ('/u01/app/oracle/oradata/kargo/redo03.log') SIZE 50 m MAXLOGFILES 5 MAXLOGMEMBERS 5 MAXLOGHISTORY 1 MAXDATAFILES 100 MAXINSTANCES 1 CHARACTER SET us7ascii NATIONAL CHARACTER SET al16utf16 DATAFILE '/u01/app/oracle/oradata/cargo/system01.dbf' SIZE 325 m REUSE EXTENT MANAGEMENT LOCAL SYSAUX DATAFILE '/u01/app/oracle/oradata/cargo/sysaux.dbf'SIZE 400 m REUSE DEFAULT TABLESPACE tbs_1 DATAFILE '/u01/app/oracle/oradata/cargo/users.dbf' SIZE 200m REUSE AUTOEXTEND ON MAXSIZE UNLIMITED DEFAULT TEMPORARY TABLESPACE tempts1 TEMPFILE '/u01/app/oracle/oradata/cargo/temp_tbs.dbf' SIZE 20m REUSE undo TABLESPACE undotbs DATAFILE '/u01/app/oracle/oradata/cargo/undo01.dbf' SIZE 200m REUSE AUTOEXTEND ON MAXSIZE UNLIMITED; |
The following scripts create views, synonyms and pl/sql packages.
|
1 2 3 4 5 |
CONNECT / AS SYSDBA @$ORACLE_HOME/rdbms/admin/catalog.sql @$ORACLE_HOME/rdbms/admin/catproc.sql |
After getting a “PL/SQL procedure successfully completed” message.
|
1 2 3 |
shutdown immediate startup |
Use the following commands to restart the database.
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
show parameters NAME TYPE VALUE O7_DICTIONARY_ACCESSIBILITY boolean FALSE active_instance_count integer aq_tm_processes integer 0 archive_lag_target integer 0 asm_diskgroups string asm_diskstring string asm_power_limit integer 1 audit_file_dest string /u01/app/oracle/product/10.2.0 /db_1/rdbms/audit audit_sys_operations boolean FALSE audit_syslog_level string NAME TYPE VALUE audit_trail string NONE background_core_dump string partial background_dump_dest string /u01/app/oracle/admin/cargo/bdump backup_tape_io_slaves boolean FALSE bitmap_merge_area_size integer 1048576 blank_trimming boolean FALSE buffer_pool_keep string buffer_pool_recycle string circuits integer cluster_database boolean FALSE NAME TYPE VALUE cluster_database_instances integer 1 cluster_interconnects string commit_point_strength integer 1 commit_write string compatible string 10.2.0 control_file_record_keep_time integer 7 control_files string /u01/app/oracle/oradata/cargo/control01.ctl |
