Use commands to create an oracle11G database and an oracle11g Database
This document describes how to create an oracle database that complies with the OFA specification using the create database Command of the oracle database.
1. Set the environment variable (vi. bash_profile or save it as an executable file for creation)
ORACLE_BASE =/u01/app
ORACLE_HOME = $ ORACLE_HOME/oracle
ORACLE_SID = hsj
PATH = $ ORACLE_HOME/bin: $ PATH
LD_LIBRARY_PATH = $ ORACLE_HOME/lib: $ LD_LIBRARY_PATH
DISPLAY = 192.168.138.1: 0.0
Export ORACLE_BASE ORACLE_HOME ORACLE_SID PATH LD_LIBRARY_PATH DISPLAY
2. Create some directories (log directory, data file directory, control file directory, and archive directory)
Mkdir-p/u01/app/flash_recovery_area/hsj
Mkdir-p/u01/app/diag/rdbms/hsj # used to store alert trace logs
Mkdir-p/u01/app/oradata/hsj/archive # is used to store archived logs. The upper-level directory is used to store control files, data files, and online log files.
Mkdir-p/u01/app/admin/hsj/adump
Mkdir-p/u01/app/admin/hsj/dpdump
Mkdir-p/u01/app/admin/hsj/pfile
Mkdir-p/u01/app/admin/hsj/scripts
3. Create the parameter file inithsj. ora and use inithsj. ora to create a spfile. The spfile must be stored in the $ ORACLE_HOME/dbs/directory.
Mkdir
Inithsj. ora File class (some parameters need to be modified according to the actual environment)
V inithsj. ora
Hsj. _ db_cache_size = 327155712
Hsj. _ java_pool_size = 4194304
Hsj. _ large_pool_size = 4194304
Hsj. _ oracle_base = '/u01/app' # ORACLE_BASE set from environment
Hsj. _ pga_aggregate_target = 331350016
Hsj. _ sga_target = 490733568
Hsj. _ shared_io_pool_size = 0
Hsj. _ shared_pool_size = 146800640
Hsj. _ streams_pool_size = 0
Audit_file_dest = '/u01/app/admin/hsj/adump'
Audit_trail = 'db'
Compatible = '11. 2.0.0.0'
Control_files = '/u01/app/oradata/hsj/control01.ctl', '/u01/app/flash_recovery_area/hsj/control02.ctl'
DB _ block_size = 8192
Db_domain =''
Db_name = 'hsj'
Db_recovery_file_dest = '/u01/app/flash_recovery_area'
Db_recovery_file_dest_size = 4039114752
Diagnostic_dest = '/u01/app'
Dispatchers = '(PROTOCOL = TCP) (SERVICE = hsjXDB )'
Log_archive_format = '% t _ % s _ % r. dbf'
Memory_target = 818937856
Nls_language = 'American'
Open_cursors = 300
Remote_login_passwordfile = 'clusive'
Undo_tablespace = 'undotbs1'
Sqlplus/as sysdba
Create spfile from pfile # Make sure it is in the dbs directory. Otherwise, you must specify the path and name of the pfile.
4. Start the database to the nomount status.
Startup nomount;
5. Create the database script createdb. SQL
Spool createdb. log
Create database hsj
User sys identified by root
User system identified by root
Logfile group 1
('/U01/app/oradata/hsj/redo01.log') size 50 M blocksize 512,
Group 2
('/U01/app/oradata/hsj/redo02.log') size 50 M blocksize 512,
Group 3
('/U01/app/oradata/hsj/redo03.log') size 50 M blocksize 512
Maxlogfiles 30
Maxlogmembers 5
Maxloghistory 1
Maxdatafiles 100
Character set al32utf8
National character set al16utf16
Extent management local
Datafile '/u01/app/oradata/hsj/system01.dbf' size 300 M reuse
Sysaux datafile '/u01/app/oradata/hsj/sysaux01.dbf' size 300 M reuse
Default tablespace users
Datafile '/u01/app/oradata/hsj/users01.dbf' size 300 M reuse
Autoextend on maxsize unlimited
Default temporary tablespace tempts1
Tempfile '/u01/app/oradata/hsj/temp01.dbf' size 20 M reuse
Undo tablespace UNDOTBS1
Datafile '/u01/app/oradata/hsj/undotbs01.dbf'
Size 200 M reuse autoextend on maxsize unlimited;
Spool off
6. Go to sqlplus and execute the database creation script.
@ Createdb. SQL
7. If an error is reported, check the createdb. log alert log and trace log.
8. Go to the $ ORACLE_HOME/rdbms/admin directory and run the SQL statement used to create the data dictionary and system package.
@ Catalog. SQL
@ Catproc. SQL
How to Create a database at oracle11g
There are two methods to create a database in Oracle. The first is to use the Oracle database creation tool DBCA, which is a graphical interface tool that is easy to use and easy to understand, because of its friendly interface, beautiful appearance, and complete prompts. In Windows, this tool can be opened in the Oracle program group ("START"-"program"-"Oracle-OraDb10g_home1"-"Configuration and Migration Tools"-"Database Configuration Assistant "), you can also directly enter dbca in the command line ("START"-"run"-"cmd") tool. Another method is to create a database manually. I will illustrate it one by one.
Manually created
Manual database creation is really troublesome, but it is necessary for developers or professional DBAs. Only in this way can you better master Oracle knowledge. Next, let's take a step-by-step exploration. Several steps are required to manually create a database. Each step is critical. It includes:
1. create necessary Directories
2. Create an initialization parameter file
3. Set the environment variable Oracle_sid.
4. Create an instance
5. Create a password file
6. Start the database to the nomount (Instance) Status
7. Execute the database creation script
8. Execute the catalog script to create a data dictionary.
9. Run catproc to create a package.
10. Run pupbld.
11. Create a spfile file from the initialization parameter file
12. Execute the scott script to create the scott mode.
My work platform
Experimental System Platform: Windows 7 Database System Version: Oracle Database 11G
Oracle installation path: name of the database created by drive D: book
1. Create related directories
Create a folder under the installation directory: D: \ product \ 11.1.0 \ db_1 \ admin \ book
In D: \ product \ 11.1.0 \ db_1 \ admin \ book, create five folders: arch, bdump, cdump, create, and udump.
Create a folder D: \ product \ 11.1.0 \ db_1 \ oradata \ book
The Directory creation process can also be created in the Windows graphical interface. The subdirectories in the book directory are mainly used to store tracking information during database operation. The two most important subdirectories are the bdump and udump directories. The bdump directory stores the tracking information of various background processes in the database running process. The alert file is a warning file, and its name is alert_book.log, when a problem occurs in the database, you can first view the file to find out the cause. You can also find the cause of various problems during manual creation. The udump directory stores trace information related to a specific session.
2. Create an initialization parameter file
When starting the database system, you must use the initialization parameter file settings to allocate memory and start necessary background processes. Therefore, whether the initialization parameter file is created correctly or whether the parameter settings are correct is related to the "fate" of the entire database ".
You can create an initialization parameter file by copying an existing initialization parameter file and modifying it as appropriate, so you do not have to write it out in one sentence manually, because the structure of the initialization parameter file is basically the same. When we install Oracle, the system has installed a database named orcl for us, so we can get an initialization parameter file from it .... Remaining full text>
Create an ORACLE database using the command line
(1) is your command incorrect?
(2) Are you using sqlplus?
(3) If you are using sqlplus, you must add the command Terminator: semicolon (;). Otherwise, oracle will think that your command has not been input. Press enter, the above 2, 3, and 4 prompts will appear. You only need to enter a semicolon and then press enter to return to SQL>