oracle 手动创建数据库

来源:互联网 发布:如何推广域名效果好 编辑:程序博客网 时间:2024/06/03 01:56
before creating
  1,define the purpose of the database
  2,define the type of the database
  3,outline the type of the database
  4,choose the database name
optimal flexible architecture


prepare the database
  1,choose a unique instance and database name
  2,choose a database character set
  3,set operating system variables
  4,create the initialization parameter file
  5,start the instance in nomount stage
  6,create and execute the create database command
  7,run scripts to generate the data dictionary and accomplish post-creation steps
  8,create aditional tablespaces as needed


step of create db
Step 1: Decide on Your Instance Identifier (SID)
  An instance is made up of the system global area (SGA) and the background processes of an Oracle Database. Decide on a unique Oracle system identifier (SID) for your instance and set the ORACLE_SID environment variable accordingly. This identifier is used to distinguish this instance from other Oracle Database instances that you may create later and run concurrently on your system.


Step 2: Establish the Database Administrator Authentication Method
  当创建了环境变量时用. ./zxntagl.env 执行,注意要先打一个点


Step 3: Create the Initialization Parameter File注意:在建库时必须确保每个路径都存在。
  创建口令文件:orapwd file=orapwzxntagl password=xionglang entries=10
  创建参数文件:
zxntagl.__db_cache_size=134217728
zxntagl.__java_pool_size=4194304
zxntagl.__large_pool_size=4194304
zxntagl.__shared_pool_size=58720256
zxntagl.__streams_pool_size=0
*.audit_file_dest='/u01/oracle/admin/zxntagl/adump'
*.background_dump_dest='/u01/oracle/admin/zxntagl/bdump'
*.compatible='10.2.0.1.0'
*.control_files='/u01/oracle/oradata/zxntagl/control01.ctl','/u01/oracle/oradata/zxntagl/control02.ctl','/u01/oracle/oradata/zxntagl/control03.ctl'
*.core_dump_dest='/u01/oracle/admin/zxntagl/cdump'
*.db_block_size=8192
*.db_domain=''
*.db_file_multiblock_read_count=8
*.db_name='zxntagl'
*.db_recovery_file_dest='/u01/oracle/flash_recovery_area'
*.db_recovery_file_dest_size=2147483648
*.dispatchers='(PROTOCOL=TCP) (SERVICE=zxntaglXDB)'
*.job_queue_processes=10
*.log_archive_format='log%t_%s_%r.arch'
*.open_cursors=300
*.pga_aggregate_target=68157440
*.processes=150
*.remote_login_passwordfile='EXCLUSIVE'
*.sga_target=205520896
*.undo_management='AUTO'
*.undo_tablespace='UNDOTBS1'
*.user_dump_dest='/u01/oracle/admin/zxntagl/udump'


Step 4: Connect to the Instance
  conn /as sysdba 


Step 5: Create a Server Parameter File (Recommended)
  
  创建spfile:create spfile from pfile;


Step 6: Start the Instance
  startup nomount
 
Step 7: Issue the CREATE DATABASE Statement
spool db.log;
CREATE DATABASE zxntagl
   USER SYS IDENTIFIED BY xionglang
   USER SYSTEM IDENTIFIED BY xionglang
   LOGFILE GROUP 1 ('/u01/oracle/oradata/zxntagl/redo01.log') SIZE 50M,
           GROUP 2 ('/u01/oracle/oradata/zxntagl/redo02.log') SIZE 50M,
           GROUP 3 ('/u01/oracle/oradata/zxntagl/redo03.log') SIZE 50M
   MAXLOGFILES 5
   MAXLOGMEMBERS 5
   MAXLOGHISTORY 1
   MAXDATAFILES 100
   MAXINSTANCES 1
   CHARACTER SET UTF8
   NATIONAL CHARACTER SET AL16UTF16
   DATAFILE '/u01/oracle/oradata/zxntagl/system01.dbf' SIZE 300M
   EXTENT MANAGEMENT LOCAL
   SYSAUX DATAFILE '/u01/oracle/oradata/zxntagl/sysaux01.dbf' SIZE 300M
   DEFAULT TEMPORARY TABLESPACE tempts1
      TEMPFILE '/u01/oracle/oradata/zxntagl/temp01.dbf'
      SIZE 20M
   UNDO TABLESPACE undotbs1
      DATAFILE '/u01/oracle/oradata/zxntagl/undotbs01.dbf'
      SIZE 200M  AUTOEXTEND ON MAXSIZE UNLIMITED;
spool off


Step 8: Create Additional Tablespaces
  create tablespace tb_zxntagl logging
     datafile '/u01/oracle/oradata/zxntagl/tb_zxntagl.dbf'
     size 100m autoextend on next 1280k maxsize unlimited
     extent management local;


Step 9: Run Scripts to Build Data Dictionary Views
  sql>spool log1.log
  sql>@/u01/oracle/10g/rdbms/admin/catalog.sql
  sql>spool log2.log
  sql>@/u01/oracle/10g/rdbms/admin/catproc.sql


Step 10: Run Scripts to Install Additional Options (Optional)
Step 11: Back Up the Database.







  
原创粉丝点击