Oracle uses commands to create an Oracle database

Source: Internet
Author: User

1. Determine the database Sid and db_name
SID = 'hsj'
Db_name = 'hsj'
2. Set the environment variable env
Oracle_base =/u01/APP
ORACLE_HOME = $ oracle_base/Oracle
Oracle_sid = hsj
Path = $ oracle_hoem/bin: $ path;
LD_LIBRARY_PATH = $ ORACLE_HOME/lib: $ LD_LIBRARY_PATH
Export oracle_base ORACLE_HOME oracle_sid path LD_LIBRARY_PATH


3. Set the logon method and use the OS logon or remote logon.
Use a local operating system user and an oracle user with DBA Permissions
Sqlplus/nolog
Conn as sysdba;
4. Create a pfile
VI inithsj. ora

Hsj. _ db_cache_size = 385875968
Hsj. _ java_pool_size = 4194304
Hsj. _ large_pool_size = 4194304
Hsj. _ shared_pool_size = 163577856
Hsj. _ streams_pool_size = 0
Audit_file_dest = '/u01/APP/admin/hsj/adump'
Background_dump_dest = '/u01/APP/admin/hsj/bdump'
Compatible = '10. 2.0.1.0'
Control_files = '/u01/APP/oradata/hsj/control01.ctl', '/u01/APP/oradata/hsj/control02.ctl', '/u01/APP/oradata/hsj/control03.ctl'
Core_dump_dest = '/u01/APP/admin/hsj/cdump'
DB _ block_size = 8192
Db_domain =''
Db_file_multiblock_read_count = 16
Db_name = 'hsj'
Db_recovery_file_dest = '/u01/APP/flash_recovery_area'
Db_recovery_file_dest_size = 2147483648
Dispatchers = '(Protocol = TCP) (Service = hsjxdb )'
Job_queue_processes = 10
Log_archive_format = '% T _ % S _ % R. dbf'
Open_cursors = 300
Pga_aggregate_target = 187695104
Processes = 150
Remote_login_passwordfile = 'clusive'
Sga_target = 563085312
Undo_management = 'auto'
Undo_tablespace = 'undotbs1'
User_dump_dest = '/u01/APP/admin/hsj/udump'

 

5. create the desired directory based on the pfile File
Create a directory hsj and Its Related subdirectories under $ oracle_base/admin.
Add a directory hsj and its subdirectory archivelog under $ oracle_base/oradate
6. Create a spfile Based on the pfile File
Startup nomount;
Create spfile from pfile;
Shutdown immediate;
7. Create orapwhsj under $ ORACLE_HOME/dbs/
Orapwd file = orapwhsj Password = root entries = 5
8. Use spfile to start the database to the nomount status.
Startup up nomount
9. Use scripts to create databases
Spool dB. log;
Create Database "hsj"
User SYS identified by root
User system identified by root
Maxdatafiles 500
Maxinstances 8
Maxlogfiles 32
Character Set "utf8"
National Character Set al16utf16
Archivelog
Datafile '/u01/APP/oradata/hsj/system01.dbf' size 300 m
Extent management local
Sysaux datafile '/u01/APP/oradata/hsj/sysaux01.dbf' size 325 m Reuse
Default temporary tablespace temp tempfile '/u01/APP/oradata/hsj/tempts01.dbf' size 100 m
Extent management local
Undo tablespace "undotbs1"
Datafile '/u01/APP/oradata/hsj/undotbs01.dbf' size 200 m
Logfile
Group 1 (
'/U01/APP/oradata/hsj/redo01a. rdo ',
'/U01/APP/oradata/hsj/redo01b. rdo'
) Size 100 m,
Group 2 (
'/U01/APP/oradata/hsj/redo02a. rdo ',
'/U01/APP/oradata/hsj/redo02b. rdo'
) Size 100 m,
Group 3 (
'/U01/APP/oradata/hsj/redo03a. rdo ',
'/U01/APP/oradata/hsj/redo03b. rdo'
) Size 100 m
;

Spool off;

10. Run the script to create a data dictionary.
@ ORACLE_HOME/admin/CATALOG. SQL (@/u01/APP/Oracle/admin/CATALOG. SQL)
@ ORACLE_HOME/admin/catproc. SQL (@/u01/APP/Oracle/admin/catproc. SQL)
11 start the database
Startup
12. Back up the database
Backup Database

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.