手动创建数据库

    技术2022-05-20  54

    今天看oracle 10g 联机文档,看到手动创建数据库部分,于是尝试了一下,步骤如下:

     

     

     

     

     

    Creating the Database

    Step 1: Decide on Your Instance Identifier (SID)

    Step 2: Establish the Database Administrator Authentication Method

    Step 3: Create the Initialization Parameter File

    Step 4: Connect to the Instance

    Step 5: Create a Server Parameter File (Recommended)

    Step 6: Start the Instance

    Step 7: Issue the CREATE DATABASE Statement

    Step 8: Create Additional Tablespaces

    Step 9: Run Scripts to Build Data Dictionary Views

    Step 10: Run Scripts to Install Additional Options (Optional)

    Step 11: Back Up the Database.

    ---------------------------------------

    根据联机文档上的步骤归纳了一下:

    1 首先创建个脚本文件来设置环境变量

    setenv.sh

    ---------------------------------------

    #!/bin/bash

    export ORACLE_BASE=/opt/oracle/export ORACLE_HOME=/opt/oracle/product/10gexport ORACLE_SID=festivalexport PATH=$ORACLE_HOME/bin:$PATH#alias sqlplus='rlwrap sqlplus'#alias rman='rlwrap rman'export LD_lIBRARY_PATH=$ORACLE_HOME/lib:$LD_LIBRARY_PATH

    ---------------------------------------

    2 创建初如化参数文件 initfestival.ora

    ---------------------------------------

    festival.__db_cache_size=188743680festival.__java_pool_size=4194304festival.__large_pool_size=4194304festival.__shared_pool_size=79691776festival.__streams_pool_size=0audit_file_dest='/opt/oracle//admin/festival/adump'background_dump_dest='/opt/oracle//admin/festival/bdump'compatible='10.2.0.1.0'control_files='/opt/oracle//oradata/festival/control01.ctl','/opt/oracle//oradata/festival/control02.ctl','/opt/oracle//oradata/festival/control03.ctl'core_dump_dest='/opt/oracle//admin/festival/cdump'db_block_size=8192db_domain=''db_file_multiblock_read_count=16db_name='festival'db_recovery_file_dest='/opt/oracle//flash_recovery_area'db_recovery_file_dest_size=2147483648dispatchers='(PROTOCOL=TCP) (SERVICE=festivalXDB)'job_queue_processes=10open_cursors=300pga_aggregate_target=92274688processes=150remote_login_passwordfile='EXCLUSIVE'sga_target=277872640undo_management='AUTO'undo_tablespace='UNDOTBS1'user_dump_dest='/opt/oracle//admin/festival/udump'

    ---------------------------------------

    3 创建相应目录

    ---------------------------------------

    mkdir -p /opt/oracle/oradata/festival

    mkdir -p /opt/oracle/admin/festival/

    mkdir -p /opt/oracle/admin/festival/adump

    mkdir -p /opt/oracle/admin/festival/bdump

    mkdir -p /opt/oracle/admin/festival/cdump

    mkdir -p /opt/oracle/admin/festival/dpdump

    mkdir -p /opt/oracle/admin/festival/pfile

    mkdir -p /opt/oracle/admin/festival/udump

    ---------------------------------------

    4 创建数据库脚本 createdb.sql

    ---------------------------------------

    spool dbcreate.log;

    create database "festival" maxdatafiles 200 maxinstances 8 maxlogfiles 32 character set "utf8" national character set al16utf16 --archivelog datafile '/opt/oracle/oradata/festival/system01.dbf' size 100M EXTENT MANAGEMENT LOCAL SYSAUX DATAFILE '/opt/oracle/oradata/festival/sysaux01.dbf' SIZE 50M REUSE default temporary tablespace temp tempfile '/opt/oracle/oradata/festival/tempts01.dbf' size 50M EXTENT MANAGEMENT LOCAL undo tablespace "UNDOTBS1" datafile '/opt/oracle/oradata/festival/undotbs01.dbf' size 50M logfile group 1 (   '/opt/oracle/oradata/festival/redo01a.rdo',   '/opt/oracle/oradata/festival/redo01b.rdo' )size 30M, group 2 (   '/opt/oracle/oradata/festival/redo02a.rdo',   '/opt/oracle/oradata/festival/redo02b.rdo' )size 30M, group 3 (   '/opt/oracle/oradata/festival/redo03a.rdo',   '/opt/oracle/oradata/festival/redo03b.rdo' )size 30M;spool off

    ---------------------------------------

    5 创建数据库

    ---------------------------------------

    [oracle@db ~]$ . ./setenv.sh[oracle@db ~]$ sqlplus /nolog

    SQL*Plus: Release 10.2.0.1.0 - Production on Fri Jan 28 04:44:32 2011

    Copyright (c) 1982, 2005, Oracle.  All rights reserved.

    SQL> conn /as sysdbaConnected to an idle instance.SQL> create spfile from pfile;

    File created.

    SQL> startup nomountORACLE instance started.

    Total System Global Area  281018368 bytesFixed Size      1218968 bytesVariable Size     88082024 bytesDatabase Buffers   188743680 bytesRedo Buffers      2973696 bytesSQL> @/home/oracle/dbcreate.sql

    Database created.

    ---------------------------------------

    6 生成数据字典

    conn sys /as sysdba@/opt/oracle/product/10g/rdbms/admin/catalog.sql@/opt/oracle/product/10g/rdbms/admin/catproc.sql

    exit


    最新回复(0)