Oracle11g手動創建數據庫方法


Oracle11g手動創建數據庫方法

參考網頁http://www.th7.cn/db/Oracle/201311/36926.shtml

安裝路徑

我的安裝路徑是:E:\app\admin\product\11.2.0\dbhome_1

DATABASE NAME、實例名以及ORACLE_SID:名字全部都是MYDB

SYS和SYSTEM等用戶的密碼:123456

 

1:創建文件夾

2:創建初始化參數文件

3:創建執行建庫腳本

4:設置環境變量

5:  創建實例

6:創建口令文件

7:啟動數據庫NOMOUNT狀態

8:執行建庫腳本 MYDB.sql  (MYDB.sql放在E盤目錄下)

9:運行腳本創建數據字典試圖

 

 

1:創建文件夾

 

拒絕訪問的話,原因是win7要以管理員身份運行。

 

 

2:創建初始化參數文件

 

init.ora文件拷貝到桌面修改好后取名為initMYDB.ora,拷貝到

E:\app\admin\product\11.2.0\dbhome_1\database

 

 

內容如下:

# $Header: rdbms/admin/init.ora /main/23 2009/05/15 13:35:38 ysarig Exp $ 

# Copyright (c) 1991, 1997, 1998 by Oracle Corporation

# NAME

#   init.ora

# FUNCTION

# NOTES

# MODIFIED

#     ysarig     05/14/09  - Updating compatible to 11.2

#     ysarig     08/13/07  - Fixing the sample for 11g

#     atsukerm   08/06/98 -  fix for 8.1.

#     hpiao      06/05/97 -  fix for 803

#     glavash    05/12/97 -  add oracle_trace_enable comment

#     hpiao      04/22/97 -  remove ifile=, events=, etc.

#     alingelb   09/19/94 -  remove vms-specific stuff

#     dpawson    07/07/93 -  add more comments regarded archive start

#     maporter   10/29/92 -  Add vms_sga_use_gblpagfile=TRUE 

#     jloaiza    03/07/92 -  change ALPHA to BETA 

#     danderso   02/26/92 -  change db_block_cache_protect to _db_block_cache_p

#     ghallmar   02/03/92 -  db_directory -> db_domain 

#     maporter   01/12/92 -  merge changes from branch 1.8.308.1 

#     maporter   12/21/91 -  bug 76493: Add control_files parameter 

#     wbridge    12/03/91 -  use of %c in archive format is discouraged 

#     ghallmar   12/02/91 -  add global_names=true, db_directory=us.acme.com 

#     thayes     11/27/91 -  Change default for cache_clone 

#     jloaiza    08/13/91 -         merge changes from branch 1.7.100.1 

#     jloaiza    07/31/91 -         add debug stuff 

#     rlim       04/29/91 -         removal of char_is_varchar2 

#   Bridge     03/12/91 - log_allocation no longer exists

#   Wijaya     02/05/91 - remove obsolete parameters

#

##############################################################################

# Example INIT.ORA file

#

# This file is provided by Oracle Corporation to help you start by providing

# a starting point to customize your RDBMS installation for your site. 

# NOTE: The values that are used in this file are only intended to be used

# as a starting point. You may want to adjust/tune those values to your

# specific hardware and needs. You may also consider using Database

# Configuration Assistant tool (DBCA) to create INIT file and to size your

# initial set of tablespaces based on the user input.

###############################################################################

 

# Change '<ORACLE_BASE>' to point to the oracle base (the one you specify at

# install time)

 

db_name='MYDB'

memory_target=1G

processes = 150

audit_file_dest='E:/app/admin/product/11.2.0/dbhome_1/admin/MYDB/adump'

audit_trail ='db'

db_block_size=8192

db_domain=''

db_recovery_file_dest='E:/app/admin/flash_recovery_area'

db_recovery_file_dest_size=2G

diagnostic_dest='E:\app\admin\product\11.2.0\dbhome_1\oradata'

dispatchers='(PROTOCOL=TCP) (SERVICE=ORCLXDB)'

open_cursors=300 

remote_login_passwordfile='EXCLUSIVE'

undo_tablespace='UNDOTBS1'

# You may want to ensure that control files are created on separate physical

# devices

control_files = (ora_control1, ora_control2)

compatible ='11.2.0'

 

 

3:創建建庫腳本

新建文本文件內容如下:

create database MYDB  

datafile 'E:/app/admin/product/11.2.0/dbhome_1/oradata/MYDB/system01.dbf' size 300M reuse autoextend on next 10240K maxsize unlimited  

extent management local  

sysaux datafile 'E:/app/admin/product/11.2.0/dbhome_1/oradata/MYDB/sysaux01.dbf' size 120M reuse autoextend on next 10240K maxsize unlimited  

default temporary tablespace temp 

tempfile 'E:/app/admin/product/11.2.0/dbhome_1/oradata/MYDB/temp01.dbf' size 20M reuse autoextend on next 640K maxsize unlimited  

undo tablespace "UNDOTBS1"  

datafile 'E:/app/admin/product/11.2.0/dbhome_1/oradata/MYDB/undotbs1.dbf' size 20M reuse autoextend on next 5120K maxsize unlimited

logfile  

group 1 ('E:/app/admin/product/11.2.0/dbhome_1/oradata/MYDB/redo01.log') size 10M,  

group 2 ('E:/app/admin/product/11.2.0/dbhome_1/oradata/MYDB/redo02.log') size 10M,  

group 3 ('E:/app/admin/product/11.2.0/dbhome_1/oradata/MYDB/redo03.log') size 10M;

 

然后另存為.sql格式

 

 

4:設置環境變量

set oracle_sid=MYDB

 

5:創建實例

oradim -new -sid MYDB

 

6:創建口令文件

orapwd file=E:\app\admin\product\11.2.0\dbhome_1\database\PWDMYDB.ora password=123456 entries=2

 

 

7:啟動數據庫NOMOUNT狀態

sqlplus /nolog

conn sys/abcdef as sysdba

 

startup nomount

 

8:執行腳本 MYDB.sql  (MYDB.sql放在E盤目錄下)

@ E:\MYDB.sql;

 

 

9:運行腳本創建數據字典視圖

SQL>@E:\app\admin\product\11.2.0\dbhome_1\RDBMS\ADMIN\catalog.sql

 

SQL>@E:\app\admin\product\11.2.0\dbhome_1\RDBMS\ADMIN\catproc.sql

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM