手工建立Oracle資料庫指令碼及說明

來源:互聯網
上載者:User
手工建立資料庫的全部指令碼及說明

系統內容:

1、作業系統:Windows 2000 Server,機器記憶體128M

2、資料庫: Oracle 8i R2 (8.1.6) for NT 企業版

3、安裝路徑:D:\ORACLE

建庫步驟:

1、手工建立相關目錄

D:\Oracle\admin\test D:\Oracle\admin\test\adhoc D:\Oracle\admin\test\bdump D:\Oracle\admin\test\cdump D:\Oracle\admin\test\create D:\Oracle\admin\test\exp D:\Oracle\admin\test\pfile D:\Oracle\admin\test\udump D:\Oracle\oradata\test D:\Oracle\oradata\test\archive 

2、手工建立初始化啟動參數檔案:D:\Oracle\admin\test\pfile\inittest.ora,內容:

db_name = "test" instance_name = test service_names = test db_files = 1024 control_files = ("D:\Oracle\oradata\test\control01.ctl", 
"D:\Oracle\oradata\test\control02.ctl", "D:\Oracle\oradata\test\control03.ctl") open_cursors = 200 max_enabled_roles = 30 db_file_multiblock_read_count = 8 db_block_buffers = 4096 shared_pool_size = 52428800 large_pool_size = 78643200 java_pool_size = 20971520 log_checkpoint_interval = 10000 log_checkpoint_timeout = 1800 processes = 115 parallel_max_servers = 5 log_buffer = 32768 max_dump_file_size = 10240 global_names = true oracle_trace_collection_name = "" background_dump_dest = D:\Oracle\admin\test\bdump user_dump_dest = D:\Oracle\admin\test\udump db_block_size = 16384 remote_login_passwordfile = exclusive os_authent_prefix = "" job_queue_processes = 4 job_queue_interval = 60 open_links = 4 distributed_transactions = 10 mts_dispatchers = "(PROTOCOL=TCP)(PRE=oracle.aurora.server.SGiopServer)" mts_dispatchers = "(protocol=TCP)" compatible = 8.1.0 sort_area_size = 65536 sort_area_retained_size = 65536 # log_archive_start = true # log_archive_dest_1 = "location=D:\Oracle\oradata\oradb\archive" # log_archive_format = %%ORACLE_SID%%T%TS%S.ARC 

3、手工建立D:\Oracle\Ora81\DATABASE\inittest.ora檔案,

內容:IFILE=’D:\Oracle\admin\test\pfile\inittest.ora’

4、使用orapwd.exe命令,建立D:\Oracle\Ora81\DATABASE\PWDtest.ora

命令:D:\Oracle\Ora81\bin\orapwd file=D:\Oracle\Ora81\DATABASE\PWDtest.ora password=ORACLE entries=5

5、通過oradim.exe命令,在服務裡產生一個新的執行個體管理服務,啟動方式為手工

set ORACLE_SID=test

D:\Oracle\Ora81\bin\oradim -new -sid test -startmode manual -pfile "D:\Oracle\admin\test\pfile\inittest.ora"

6、產生各種資料庫物件

D:\ >svrmgrl

--建立資料庫

connect INTERNAL/oracle startup nomount pfile="D:\Oracle\admin\test\pfile\inittest.ora" CREATE DATABASE test LOGFILE ’D:\Oracle\oradata\test\redo01.log’ SIZE 2048K, ’D:\Oracle\oradata\test\redo02.log’ SIZE 2048K, ’D:\Oracle\oradata\test\redo03.log’ SIZE 2048K MAXLOGFILES 32 MAXLOGMEMBERS 2 MAXLOGHISTORY 1 DATAFILE ’D:\Oracle\oradata\test\system01.dbf’ 
SIZE 58M REUSE AUTOEXTEND ON NEXT 640K MAXDATAFILES 254 MAXINSTANCES 1 CHARACTER SET ZHS16GBK NATIONAL CHARACTER SET ZHS16GBK; 

控制檔案、記錄檔在上面語句執行時產生

connect INTERNAL/oracle

--修改系統資料表空間

ALTER TABLESPACE SYSTEM DEFAULT STORAGE ( INITIAL 64K NEXT 64K MINEXTENTS 1 MAXEXTENTS UNLIMITED PCTINCREASE 50);

ALTER TABLESPACE SYSTEM MINIMUM EXTENT 64K;

--建立復原資料表空間

CREATE TABLESPACE RBS DATAFILE ’D:\Oracle\oradata\test\rbs01.dbf’ SIZE 256M REUSE AUTOEXTEND ON NEXT 5120K MINIMUM EXTENT 512K DEFAULT STORAGE ( INITIAL 512K NEXT 512K MINEXTENTS 8 MAXEXTENTS 4096); 

--建立使用者資料表空間

CREATE TABLESPACE USERS DATAFILE ’D:\Oracle\oradata\test\users01.dbf’ SIZE 128M REUSE AUTOEXTEND ON NEXT 1280K MINIMUM EXTENT 128K DEFAULT STORAGE ( INITIAL 128K NEXT 128K MINEXTENTS 1 MAXEXTENTS 4096 PCTINCREASE 0); 

--建立暫存資料表空間

CREATE TABLESPACE TEMP DATAFILE ’D:\Oracle\oradata\test\temp01.dbf’ SIZE 32M REUSE AUTOEXTEND ON NEXT 640K MINIMUM EXTENT 64K DEFAULT STORAGE ( INITIAL 64K NEXT 64K MINEXTENTS 1 MAXEXTENTS 
UNLIMITED PCTINCREASE 0) TEMPORARY; 

--建立工具資料表空間

CREATE TABLESPACE TOOLS DATAFILE ’D:\Oracle\oradata\test\tools01.dbf’ SIZE 64M REUSE AUTOEXTEND ON NEXT 320K MINIMUM EXTENT 32K DEFAULT STORAGE ( INITIAL 32K NEXT 32K MINEXTENTS 1 MAXEXTENTS 4096 PCTINCREASE 0); 

--建立索引資料表空間

CREATE TABLESPACE INDX DATAFILE ’D:\Oracle\oradata\test\indx01.dbf’ SIZE 32M REUSE AUTOEXTEND ON NEXT 1280K MINIMUM EXTENT 128K DEFAULT STORAGE ( INITIAL 128K NEXT 128K MINEXTENTS 1 MAXEXTENTS 4096 PCTINCREASE 0); 

--建立復原段

CREATE PUBLIC ROLLBACK SEGMENT RBS0 TABLESPACE RBS STORAGE ( OPTIMAL 4096K ); CREATE PUBLIC ROLLBACK SEGMENT RBS1 TABLESPACE RBS STORAGE ( OPTIMAL 4096K ); CREATE PUBLIC ROLLBACK SEGMENT RBS2 TABLESPACE RBS STORAGE ( OPTIMAL 4096K ); CREATE PUBLIC ROLLBACK SEGMENT RBS3 TABLESPACE RBS STORAGE ( OPTIMAL 4096K ); CREATE PUBLIC ROLLBACK SEGMENT RBS4 TABLESPACE RBS STORAGE ( OPTIMAL 4096K ); CREATE PUBLIC ROLLBACK SEGMENT RBS5 TABLESPACE RBS STORAGE ( OPTIMAL 4096K ); CREATE PUBLIC ROLLBACK SEGMENT RBS6 TABLESPACE RBS STORAGE ( OPTIMAL 4096K ); CREATE PUBLIC ROLLBACK SEGMENT RBS7 TABLESPACE RBS STORAGE ( OPTIMAL 4096K ); CREATE PUBLIC ROLLBACK SEGMENT RBS8 TABLESPACE RBS STORAGE ( OPTIMAL 4096K ); CREATE PUBLIC ROLLBACK SEGMENT RBS9 TABLESPACE RBS STORAGE ( OPTIMAL 4096K ); CREATE PUBLIC ROLLBACK SEGMENT RBS10 TABLESPACE RBS STORAGE ( OPTIMAL 4096K ); CREATE PUBLIC ROLLBACK SEGMENT RBS11 TABLESPACE RBS STORAGE ( OPTIMAL 4096K ); CREATE PUBLIC ROLLBACK SEGMENT RBS12 TABLESPACE RBS STORAGE ( OPTIMAL 4096K ); CREATE PUBLIC ROLLBACK SEGMENT RBS13 TABLESPACE RBS STORAGE ( OPTIMAL 4096K ); CREATE PUBLIC ROLLBACK SEGMENT RBS14 TABLESPACE RBS STORAGE ( OPTIMAL 4096K ); CREATE PUBLIC ROLLBACK SEGMENT RBS15 TABLESPACE RBS STORAGE ( OPTIMAL 4096K ); CREATE PUBLIC ROLLBACK SEGMENT RBS16 TABLESPACE RBS STORAGE ( OPTIMAL 4096K ); CREATE PUBLIC ROLLBACK SEGMENT RBS17 TABLESPACE RBS STORAGE ( OPTIMAL 4096K ); CREATE PUBLIC ROLLBACK SEGMENT RBS18 TABLESPACE RBS STORAGE ( OPTIMAL 4096K ); CREATE PUBLIC ROLLBACK SEGMENT RBS19 TABLESPACE RBS STORAGE ( OPTIMAL 4096K ); CREATE PUBLIC ROLLBACK SEGMENT RBS20 TABLESPACE RBS STORAGE ( OPTIMAL 4096K ); CREATE PUBLIC ROLLBACK SEGMENT RBS21 TABLESPACE RBS STORAGE ( OPTIMAL 4096K ); CREATE PUBLIC ROLLBACK SEGMENT RBS22 TABLESPACE RBS STORAGE ( OPTIMAL 4096K ); CREATE PUBLIC ROLLBACK SEGMENT RBS23 TABLESPACE RBS STORAGE ( OPTIMAL 4096K ); CREATE PUBLIC ROLLBACK SEGMENT RBS24 TABLESPACE RBS STORAGE ( OPTIMAL 4096K ); 

--使復原段線上

ALTER ROLLBACK SEGMENT "RBS0" ONLINE; ALTER ROLLBACK SEGMENT "RBS1" ONLINE; ALTER ROLLBACK SEGMENT "RBS2" ONLINE; ALTER ROLLBACK SEGMENT "RBS3" ONLINE; ALTER ROLLBACK SEGMENT "RBS4" ONLINE; ALTER ROLLBACK SEGMENT "RBS5" ONLINE; ALTER ROLLBACK SEGMENT "RBS6" ONLINE; ALTER ROLLBACK SEGMENT "RBS7" ONLINE; ALTER ROLLBACK SEGMENT "RBS8" ONLINE; ALTER ROLLBACK SEGMENT "RBS9" ONLINE; ALTER ROLLBACK SEGMENT "RBS10" ONLINE; ALTER ROLLBACK SEGMENT "RBS11" ONLINE; ALTER ROLLBACK SEGMENT "RBS12" ONLINE; ALTER ROLLBACK SEGMENT "RBS13" ONLINE; ALTER ROLLBACK SEGMENT "RBS14" ONLINE; ALTER ROLLBACK SEGMENT "RBS15" ONLINE; ALTER ROLLBACK SEGMENT "RBS16" ONLINE; ALTER ROLLBACK SEGMENT "RBS17" ONLINE; ALTER ROLLBACK SEGMENT "RBS18" ONLINE; ALTER ROLLBACK SEGMENT "RBS19" ONLINE; ALTER ROLLBACK SEGMENT "RBS20" ONLINE; ALTER ROLLBACK SEGMENT "RBS21" ONLINE; ALTER ROLLBACK SEGMENT "RBS22" ONLINE; ALTER ROLLBACK SEGMENT "RBS23" ONLINE; ALTER ROLLBACK SEGMENT "RBS24" ONLINE; 

--修改sys使用者的暫存資料表空間為TEMP

alter user sys temporary tablespace TEMP;

--建立資料字典表

@D:\Oracle\Ora81\Rdbms\admin\catalog.sql; @D:\Oracle\Ora81\Rdbms\admin\catexp7.sql @D:\Oracle\Ora81\Rdbms\admin\catproc.sql @D:\Oracle\Ora81\Rdbms\admin\caths.sql connect system/manager @D:\Oracle\Ora81\sqlplus\admin\pupbld.sql connect internal/oracle @D:\Oracle\Ora81\Rdbms\admin\catrep.sql exit 

--產生SQL*Plus協助系統

sqlplus SYSTEM/manager

@D:\Oracle\Ora81\sqlplus\admin\help\helpbld.sql helpus.sql

exit

--修改system使用者預設資料表空間和暫存資料表空間

svrmgrl

connect internal/oracle

alter user system default tablespace TOOLS;

alter user system temporary tablespace TEMP;

exit

7、將test執行個體啟動服務設定成自動啟動方式

D:\Oracle\Ora81\bin\oradim -edit -sid test -startmode auto

(完)

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

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.