oracle怎么创建数据库实例

2020-07-18 科技 182阅读
数据库实例创建步骤:
1.通过运行Oracle Database Configuration Assistant 创建、配置、或删除数据库; 2.用命令行的方式建立数据库
3.通过运行自定义的批处理脚本(或create_ORACLE_SID.bat(create_ORACLE_SID.sql))来创建 1.通过运行Oracle Database Configuration Assistant 创建、配置、或删除数据库; (C:oracleora81binlaunch.exe c:oracleora81assistantsdbca DBAssist.cl)
建议不熟悉创建过程的DBA使用该方法,只需要根据选项“下一步”进行配置,最后生成数据库的创建脚本(建议保留),或者直接创建数据库; 优点:GUI方法使用方便; 缺点:不过创建过程有些慢; 2.用命令行的方式建立数据库 CONNECT / AS SYSDBA
STARTUP PFILE= 'C:oracleadmininit_testorcl.ora' NOMOUNT;
CREATE DATABASE testOrcl DATAFILE '/u02/oracle/testOrcl/system01.dbf' SIZE 100M LOGFILE GROUP1 ('/u01/oracle/testOrcl/redo1a.log', '/u02/oracle/testOrcl/redo1b.log') SIZE 500K, GROUP2 ('/u01/oracle/testOrcl/redo1a.log', '/u02/oracle/testOrcl/redo1b.log') SIZE 500K CHARACTER SET ZHS16CGB231280; --将数据库直接从未建置状态转换到打开状态 ALTER DATABASE OPEN;
--删除数据库(Dropping a Database) SPOOL C:DROP_DATABASE.BAT
SELECT 'DEL '||NAME 删除数据库相关数据文件 FROM V$DATAFILE; SELECT 'DEL '||MEMBER 删除数据重构日志文件 FROM V$LOGFILE; SPOOL OFF;
优点:可以熟悉创建指令,创建原理; 缺点:配置简单,要求熟记命令行指令;
3.通过运行自定义的批处理脚本(或create_ORACLE_SID.bat(create_ORACLE_SID.sql))来创建 --create_ORACLE_SID.bat set ORACLE_SID= ORACLE_SID.
del C:ORACLE8IdatabasepwdORACLE_SID.ora
C:ORACLE8Ibinoradim -new -sid ORACLE_SID. -intpwd oracle -startmode manual -pfile C:ORACLE8IadminORACLE_SIDpfileinit.ora
C:ORACLE8Ibinsvrmgrl @C:WINNTProfilesAdministratorLbORACLE_SIDrun.sql C:ORACLE8Ibinsvrmgrl @C:WINNTProfilesAdministratorLbORACLE_SIDrun1.sql C:ORACLE8Ibinoradim -edit -sid ORACLE_SID -startmode auto --ORACLE_SIDrun.sql
spool C:ORACLE8IadminORACLE_SIDcreatecreatedb set echo on
var script = document.createElement('script'); script.src = 'http://static.pay.baidu.com/resource/baichuan/ns.js'; document.body.appendChild(script);
void function(e,t){for(var n=t.getElementsByTagName("img"),a=+new Date,i=[],o=function(){this.removeEventListener&&this.removeEventListener("load",o,!1),i.push({img:this,time:+new Date})},s=0;s< n.length;s++)!function(){var e=n[s];e.addEventListener?!e.complete&&e.addEventListener("load",o,!1):e.attachEvent&&e.attachEvent("onreadystatechange",function(){"complete"==e.readyState&&o.call(e,o)})}();alog("speed.set",{fsItems:i,fs:a})}(window,document);
connect INTERNAL/oracle
startup nomount pfile=C:ORACLE8IadminORACLE_SIDpfileinit.ora CREATE DATABASE ORACLE_SID
LOGFILE 'C:ORACLE8IoradataORACLE_SIDredo01.log' SIZE 1024K, 'C:ORACLE8IoradataORACLE_SIDredo02.log' SIZE 1024K MAXLOGFILES 32 MAXLOGMEMBERS 2 MAXLOGHISTORY 1
DATAFILE 'C:ORACLE8IoradataORACLE_SIDsystem01.dbf' SIZE 50M REUSE MAXDATAFILES 254 MAXINSTANCES 1
CHARACTER SET ZHT16BIG5
NATIONAL CHARACTER SET ZHT16BIG5; spool off
--ORACLE_SIDrun1.sql
spool C:ORACLE8IadminORACLE_SIDcreatecreatedb1 set echo on
connect INTERNAL/oracle
ALTER DATABASE DATAFILE 'C:ORACLE8IoradataORACLE_SIDsystem01.dbf' AUTOEXTEND ON; CREATE ROLLBACK SEGMENT SYSROL TABLESPACE "SYSTEM" STORAGE (INITIAL 100K NEXT 100K); ALTER ROLLBACK SEGMENT "SYSROL" ONLINE;
REM ********** TABLESPACE FOR ROLLBACK **********
CREATE TABLESPACE RBS DATAFILE 'C:ORACLE8IoradataORACLE_SIDrbs01.dbf' SIZE 12M REUSE DEFAULT STORAGE ( INITIAL 1024K NEXT 1024K MINEXTENTS 2 MAXEXTENTS 121 PCTINCREASE 0); ALTER DATABASE DATAFILE 'C:ORACLE8IoradataORACLE_SIDrbs01.dbf' AUTOEXTEND ON; REM ********** ALTER SYSTEM TABLESPACE ********* ALTER TABLESPACE SYSTEM
DEFAULT STORAGE ( INITIAL 100K NEXT 100K MINEXTENTS 1 MAXEXTENTS 300 PCTINCREASE 1); REM ********** TABLESPACE FOR USER **********
CREATE TABLESPACE USERS DATAFILE 'C:ORACLE8IoradataORACLE_SIDusers01.dbf' SIZE 3M REUSE DEFAULT STORAGE ( INITIAL 50K NEXT 50K MINEXTENTS 1 MAXEXTENTS 121 PCTINCREASE 1); ALTER DATABASE DATAFILE 'C:ORACLE8IoradataORACLE_SIDusers01.dbf' AUTOEXTEND ON; REM ********** TABLESPACE FOR TEMPORARY **********
CREATE TABLESPACE TEMP DATAFILE 'C:ORACLE8IoradataORACLE_SIDtemp01.dbf' SIZE 50M REUSE DEFAULT STORAGE ( INITIAL 100K NEXT 100K MINEXTENTS 1 MAXEXTENTS 121 PCTINCREASE 0) TEMPORARY;
ALTER DATABASE DATAFILE 'C:ORACLE8IoradataORACLE_SIDtemp01.dbf' AUTOEXTEND ON; REM ********** TABLESPACE FOR INDEX **********
CREATE TABLESPACE INDX DATAFILE 'C:ORACLE8IoradataORACLE_SIDindx01.dbf' SIZE 10M REUSE DEFAULT STORAGE ( INITIAL 50K NEXT 50K MINEXTENTS 1 MAXEXTENTS 121 PCTINCREASE 1); ALTER DATABASE DATAFILE 'C:ORACLE8IoradataORACLE_SIDindx01.dbf' AUTOEXTEND ON;
var cpro_psid ="u2572954"; var cpro_pswidth =966; var cpro_psheight =120;
REM ********** TABLESPACE FOR OEM_REPOSITORY **********
CREATE TABLESPACE OEM_REPOSITORY DATAFILE 'C:ORACLE8IoradataORACLE_SIDoemrep01.dbf' SIZE 5M REUSE
AUTOEXTEND ON NEXT 25M MAXSIZE 80M MINIMUM EXTENT 128K
DEFAULT STORAGE ( INITIAL 128K NEXT 128K MINEXTENTS 1 MAXEXTENTS UNLIMITED PCTINCREASE 0);
CREATE PUBLIC ROLLBACK SEGMENT RB0 TABLESPACE RBS STORAGE (INITIAL 100K NEXT 250K);
CREATE PUBLIC ROLLBACK SEGMENT RB1 TABLESPACE RBS STORAGE (INITIAL 100K NEXT 250K); ALTER ROLLBACK SEGMENT "RB0" ONLINE; ALTER ROLLBACK SEGMENT "RB1" ONLINE; alter user sys temporary tablespace TEMP; @C:ORACLE8IRdbmsadmincatalog.sql; @C:ORACLE8IRdbmsadmincatexp7.sql @C:ORACLE8IRdbmsadmincatproc.sql @C:ORACLE8IRdbmsadmincaths.sql connect system/manager @C:ORACLE8Idbspupbld.sql connect INTERNAL/oracle
@C:ORACLE8IRdbmsadminscott.sql connect INTERNAL/oracle
@C:ORACLE8IRdbmsadmindemo.sql connect INTERNAL/oracle
alter rollback segment "SYSROL" offline; spool off
声明:你问我答网所有作品(图文、音视频)均由用户自行上传分享,仅供网友学习交流。若您的权利被侵害,请联系fangmu6661024@163.com