In Linux, although you can create databases through dbca, you cannot use a graphical environment in some environments, for example, the database server is in the data center and the open ports are limited, you can also create databases in batches. In this case, you have to create a database manually for convenience. Follow these steps to create a database:
Operating System: CentOS 5 (modify/etc/RedHat-real * input redhat enterprise 4 during installation)
Database: Oracle 10g
Environment:
You have used dbca to create the database orcl.
Oracle user group: oracle, dba
ORACLE_BASE =/home/oracle/
ORACLE_HOME = $ ORACLE_BASE/db1
ORACLE_SID = test
ORACLE_OWNER = oracle
NLS_LANG = "Simplified Chinese_china"
DB_HOME =/home/oracle/oradata
Steps:
1. Create a pfile
Use sqlplus sys/orcl @ orcl as sysdba to log on to the orcl database environment and use the command
Create pfile from spfile; create a pfile
Go to the system and run the command in the $ ORACLE_HOME/dbs/directory.
Cp initorcl. ora inittest. ora
Or directly run the command in the $ ORACLE_HOME/dbs/directory of the system.
Strings spfileorcl. ora> inittest. ora
Modify the inittest. ora file and replace orcl with test.
2. Create a password file
Cd $ ORACLE_HOME/dbs/
Orapwd file = orapwtest password = test
3. Create a directory
Mkdir-p $ ORACLE_BASE/admin/test
Cd $ ORACLE_BASE/admin/test
Mkdir adump bdump cdump dpdump pfile
Mkdir-p $ DB_HOME/test
4. Modify the listener
Vi $ ORACLE_HOME/network/admin/tnsnames. ora
Copy and paste the ORCL part and change its name to test.
5. Start database creation
Export ORACLE_SID = test
Sqlplus/nolog
Conn/as sysdba
Spool $ ORACLE_BASE/admin/$ ORACLE_SID/create/createdb
Startup nomount
Create database test
LOGFILE
GROUP 1 ('$ DB_HOME/test/redo01.log ',
'$ ORACLE_BASE/oradata/test/redo01_1.log') size 100 m reuse,
GROUP 2 ('$ DB_HOME/test/redo02.log ',
'$ DB_HOME/test/redo02_1.log') size 100 m reuse,
GROUP 3 ('$ DB_HOME/oradata/test/redo03.log ',
'$ DB_HOME/test/redo03_1.log') size 100 m reuse
MAXLOGFILES 50
MAXLOGMEMBERS 5
# MAXLOGHISTORY 200
MAXDATAFILES 500
MAXINSTANCES 5
ARCHIVELOG
Character set UTF8
National character set UTF8
DATAFILE '$ DB_HOME/test/system01.dbf' SIZE 1000 M EXTENT MANAGEMENT LOCAL
Sysaux datafile '$ DB_HOME/test/sysaux01.dbf' SIZE 1000 M
Undo tablespace UNDOTBS1 DATAFILE '$ DB_HOME/test/undo. dbf' SIZE 500 M
DEFAULT TEMPORARY TABLESPACE TEMP TEMPFILE
'$ DB_HOME/test/temp. dbf' SIZE 500 M
;
Wait for a certain period of time. If there is no problem, it will show that the database is successfully created. Note that the name in undo tablespace UNDOTBS1 must be the same as that in inittest. ora.
@ $ ORACLE_HOME/rdbms/admin/catalog. SQL;
@ $ ORACLE_HOME/rdbms/admin/catproc. SQL;
@ $ ORACLE_HOME/rdbms/admin/catdbsyn. SQL;
Alter user system identified by test;
Grant sysdba to system;
Shutdown immediate;
Startup;
Spool off
Exit
Use system User Login
Sqlplus system/test
@ $ ORACLE_HOME/sqlplus/admin/pupbld. SQL
Exit
The database has been created.
If you have any problems, you can view the logs.
$ ORACLE_BASE/admin/$ ORACLE_SID/create/createdb