1. 程式人生 > >oracle11.2.0.1靜默安裝之dbca靜默建庫

oracle11.2.0.1靜默安裝之dbca靜默建庫

1) 生成響應檔案:

[[email protected] response]$ cp netca.rsp ../netca.rsp^C
[[email protected] response]$ pwd
/home/oracle/database/response
[[email protected] response]$

2)更改拷貝的響應檔案:

#--------------------------------------------------------------------

#以下引數不要更改

[GENERAL]

RESPONSEFILE_VERSION = "11.2.0"

OPERATION_TYPE = "createDatabase"

#以下引數必須設定

[CREATEDATABASE]

GDBNAME = "orcl"

TEMPLATENAME = "General_Purpose.dbc"

#以下引數不設定則使用預設值,建議設定

CHARACTERSET = "ZHS16GBK"

TOTALMEMORY = "1024"

#--------------------------------------------------------------------

3)靜默建庫:

$ $ORACLE_HOME/bin/dbca -silent -responseFile $DISTRIB/db_create.rsp

Enter SYS user password: 

<輸入sys使用者密碼> 

Enter SYSTEM user password: 

<輸入system使用者密碼> 

Copying database files

...

37% complete

Creating and starting Oracle instance

...

62% complete

Completing Database Creation

...

100% complete

Look at the log file "/u01/app/oracle/cfgtoollogs/dbca/ORCL/ORCL.log" for further details.

 

各引數含義如下:

-silent 表示以靜默方式安裝

-responseFile 表示使用哪個響應檔案,必需使用絕對路徑

RESPONSEFILE_VERSION 響應檔案模板的版本,該引數不要更改

OPERATION_TYPE 安裝型別,該引數不要更改

GDBNAME 全域性資料庫名,點號前面預設是db_name,點號後面預設就是db_domain

TEMPLATENAME 建庫模板名,參考各模板定義:$ORACLE_HOME/assistants/dbca/templates/*.dbc

CHARACTERSET 字符集,預設是WE8MSWIN1252

TOTALMEMORY 例項記憶體,預設是伺服器實體記憶體的40%

4)建庫後例項檢查

ps -ef|grep ora_

5)建庫後監聽檢查

lsnrctl status

LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 23-APR-2018 18:09:25

Copyright (c) 1991, 2009, Oracle.  All rights reserved.

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 11.2.0.1.0 - Production
Start Date                23-APR-2018 16:52:30
Uptime                    0 days 1 hr. 16 min. 55 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /u01/app/oracle/product/11.2.0.1/db_home1/network/admin/listener.ora
Listener Log File         /u01/app/oracle/diag/tnslsnr/srcxtts/listener/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=srcxtts)(PORT=1521)))
Services Summary...
Service "ORCLXDB" has 1 instance(s).
  Instance "orcl", status READY, has 1 handler(s) for this service...
Service "orcl" has 1 instance(s).
  Instance "orcl", status READY, has 1 handler(s) for this service...
The command completed successfully

6)啟動例項

SQL> startup
ORA-01078: failure in processing system parameters

LRM-00109: could not open parameter file '/u01/app/oracle/product/11.2.0.1/db_home1/dbs/initorcl.ora'


檔案不存在,直接根據模板init.ora拷貝一份

cp init.ora initorcl.ora

然後把裡面相關路徑改一下,此處主要把<ORACLE_BASE>換成/u01/app/oracle

[[email protected] dbs]$ cat initorcl.ora
# 
# $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='orcl'
memory_target=900M
processes = 150
audit_file_dest='/u01/app/oracle/admin/orcl/adump'
audit_trail ='db'
db_block_size=8192
db_domain=''
db_recovery_file_dest='/u01/app/oracle/flash_recovery_area'
db_recovery_file_dest_size=2G
diagnostic_dest='/u01/app/oracle/'
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'
[[email protected] dbs]$ 

再次啟動:

SQL> startup nomount
ORACLE instance started.


Total System Global Area  939495424 bytes
Fixed Size                  2218952 bytes
Variable Size             545260600 bytes
Database Buffers          385875968 bytes

Redo Buffers                6139904 bytes

7)啟動到mount

SQL> alter database mount;
alter database mount
*
ERROR at line 1:

ORA-01102: cannot mount database in EXCLUSIVE mode

解決辦法:

網上找了一篇帖子,如下做的:

分析原因:

一、在HA系統中,已經有其他節點啟動了例項,將雙機共享的資源(如磁碟陣列上的裸裝置)佔用了;

二、說明Oracle被異常關閉時,有資源沒有被釋放,一般有以下幾種可能,

1、 Oracle的共享記憶體段或訊號量沒有被釋放;

2、 Oracle的後臺程序(如SMON、PMON、DBWn等)沒有被關閉;

3、 用於鎖記憶體的檔案lk<sid>和sgadef<sid>.dbf檔案沒有被刪除。

解決思路:

當發生1102錯誤時,可以按照以下流程檢查、排錯:

如果是HA系統,檢查其他節點是否已經啟動例項檢查Oracle程序是否存在,如果存在則殺掉程序檢查訊號量是否存在,如果存在,則清除訊號量檢查共享記憶體段是否存在,如果存在,則清除共享記憶體段檢查鎖記憶體檔案lk<sid>和sgadef<sid>.dbf是否存在,如果存在,則刪除。

具體做法:

首先,雖然我們的系統是HA系統,但是備節點的例項始終處在關閉狀態,這點通過在備節點上查資料庫狀態可以證實。

其次、是因系統掉電引起資料庫宕機的,系統在接電後被重啟,因此我們排除了第二種可能種的1、2點。最可疑的就是第3點了。

查$ORACLE_HOME/dbs目錄:

$ cd $ORACLE_HOME/dbs

$ ls sgadef*

sgadef* not found

$ ls lk*

/opt/oracle/product/ 10.2.0/db_1/dbs/lkSIMPLY

lkSIMPLY

果然,lk<sid>檔案沒有被刪除。將它刪除掉

$ rm lk*

刪除後再次啟動

SQL> alter database mount ;
alter database mount
*
ERROR at line 1:

ORA-00205: error in identifying control file, check alert log for more info

錯誤變成找不到控制檔案了,這好辦,我們新庫,還沒有控制檔案,這個後面在說。

然後按照上面那篇帖子:

https://blog.csdn.net/lzwgood/article/details/26368323

把oracle的共享記憶體清了:

檢視共享記憶體段

[[email protected] bdump]# ipcs -map

------ Shared Memory Creator/Last-op --------

shmid   owner  cpid    lpid

786444  root    6490   6438

819213  root    6549   6438

1409040 oracle   31502  16728

根據ID號清楚共享記憶體段

ipcrm –m 1409040

我這裡操作是沒有成功的,不過執行了下面的操作就ok了!

檢視訊號量

[[email protected] bdump]# ipcs -s

key       semid      owner   perms    nsems

0x17ff6454 360448     oracle    640     154

清除oracle的訊號量

[[email protected] bdump]# ipcrm -s 360448

再次查詢確認

[[email protected] bdump]# ipcs -s

------ Semaphore Arrays --------

key  semid  owner  perms   nsems

再查詢共享記憶體段也ok了!

[[email protected] bdump]# ipcs -m

再次啟動的時候,又報了下面的錯:

SQL> startup
ORA-00845: MEMORY_TARGET not supported on this system

後來df -h發現/dev/shm總共930M,現在可用只有400多M,而memory_target設定的是900M。

memory_max_target                    big integer 900M

memory_target                        big integer 900M

考慮/dev/shm大小不夠,增大之:

 mount -t tmpfs shmfs -o size=2g /dev/shm

修改配置檔案/etc/fstab

tmpfs                   /dev/shm                tmpfs   defaults,size=2g        0 0

全量重新掛載

mount -a

[[email protected] dbs]$ df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/vg_srcxtts-lv_root
                       21G   12G  7.3G  62% /
tmpfs                 2.0G  538M  1.5G  27% /dev/shm
/dev/sda1             477M   60M  392M  14% /boot

shmfs                 2.0G  538M  1.5G  27% /dev/shm

再次重新啟動到mount:

SQL> alter database mount ;
alter database mount
*
ERROR at line 1:
ORA-00205: error in identifying control file, check alert log for more info

又回到控制檔案的問題了,不要急,接著來。

截止到現在我們資料庫用的還是pfile檔案,要改成使用spfile檔案:

SQL> show parameter pfile


NAME                                 TYPE
------------------------------------ ----------------------
VALUE
------------------------------
spfile                               string


SQL> create spfile from pfile ;


File created.


SQL> show parameter pfile


NAME                                 TYPE
------------------------------------ ----------------------
VALUE
------------------------------
spfile                               string


SQL> shutdown immediate 
ORA-01507: database not mounted




ORACLE instance shut down.
SQL> startup nomount ;
ORACLE instance started.


Total System Global Area  939495424 bytes
Fixed Size                  2218952 bytes
Variable Size             545260600 bytes
Database Buffers          385875968 bytes
Redo Buffers                6139904 bytes
SQL> show parameter pfile


NAME                                 TYPE
------------------------------------ ----------------------
VALUE
------------------------------
spfile                               string
/u01/app/oracle/product/11.2.0

.1/db_home1/dbs/spfileorcl.ora

現在已經改成使用spfile檔案了。

8)下面就來搞控制檔案,oracle靜默安裝好後,預設給了個空檔案在/u01/app/oracle/oradata/orcl/control01.ctl

拷貝兩份到/u01/app/oracle/product/11.2.0.1/db_home1/dbs/control01.ctl,/u01/app/oracle/product/11.2.0.1/db_home1/dbs/control02.ctl


改初始化引數配置

SQL> show parameter control  


NAME                                 TYPE
------------------------------------ ----------------------
VALUE
------------------------------
control_file_record_keep_time        integer
7
control_files                        string
/u01/app/oracle/product/11.2.0
.1/db_home1/dbs/ora_control1,
/u01/app/oracle/product/11.2.0
.1/db_home1/dbs/ora_control2
control_management_pack_access       string

DIAGNOSTIC+TUNING

SQL> alter system set control_files="/u01/app/oracle/product/11.2.0.1/db_home1/dbs/control01.ctl","/u01/app/oracle/product/11.2.0.1/db_home1/dbs/control02.ctl" scope=spfile
  2  ;


System altered.

SQL> show parameter control


NAME                                 TYPE
------------------------------------ ----------------------
VALUE
------------------------------
control_file_record_keep_time        integer
7
control_files                        string
/u01/app/oracle/product/11.2.0
.1/db_home1/dbs/ora_control1,
/u01/app/oracle/product/11.2.0
.1/db_home1/dbs/ora_control2
control_management_pack_access       string
DIAGNOSTIC+TUNING
SQL> shutdown immediate
ORA-01507: database not mounted




ORACLE instance shut down.
SQL> startup nomount
ORACLE instance started.


Total System Global Area  939495424 bytes
Fixed Size                  2218952 bytes
Variable Size             545260600 bytes
Database Buffers          385875968 bytes
Redo Buffers                6139904 bytes
SQL> show parameter control


NAME                                 TYPE
------------------------------------ ----------------------
VALUE
------------------------------
control_file_record_keep_time        integer
7
control_files                        string
/u01/app/oracle/product/11.2.0
.1/db_home1/dbs/control01.ctl,
 /u01/app/oracle/product/11.2.
0.1/db_home1/dbs/control02.ctl
control_management_pack_access       string
DIAGNOSTIC+TUNING
SQL> alter database mount;


Database altered.


SQL> alter database open;


Database altered.


SQL> select instance_name,status from v$instance ;


INSTANCE_NAME    STATUS
---------------- ------------
orcl             OPEN

最後改完重啟資料,然後就可以打開了。

相關推薦

oracle11.2.0.1靜默安裝dbca靜默

1) 生成響應檔案:[[email protected] response]$ cp netca.rsp ../netca.rsp^C[[email protected] response]$ pwd/home/oracle/database/respon

OracleLinux6.5下Oracle11.2.0.4的安裝

following 升級 打開終端 alt min oinstall 路徑 product 設置環境變量 接http://blog.51cto.com/12784425/2310379此文1、準備工作Oracle11.2.0.4的安裝包;VNC客戶端vnc Viewer;

oracle11.2.0.1.0 連線 python3.5.1

1.    cx_Oracle:cx_Oracle-6.0rc2-cp35-cp35m-win_amd64.whl        下載網址:https://pypi.python.org/pypi/cx_Oracle/5.3 2.

Oracle11.2.0.1.0節點1叢集不能正常啟動,報CRS-4535,CRS-4530

2014-07-18 17:17:58.018: [GIPCXCPT][2517008128]gipcmodGipcPassInitializeNetwork: failed to find any interfaces in clsinet, ret gipcretFail (1) 2014-07-18 1

Oracle11.2.0.1.0叢集資料庫不能正常啟動,報ORA-01078,ORA-01565,ORA-17503,ORA-12547錯誤

[[email protected] ~]$ crs_stat -t Name           Type           Target    State     Host         ----------------------------------------------------

發現Oracle11.2.0.1關於NLS_LENGTH_SEMANTICS的一個Bug

這段時間在做資料遷移,需要從10g的ZHS16GBK字符集的資料庫裡面遷移資料到11g的UTF8字元的資料庫,並且源資料庫的NLS_LENGTH_SEMANTICS引數值為Byte,目標端的NLS_LENGTH_SEMANTICS引數值為CHAR。如果直接從源使用exp/e

oracle11.2.0.1網絡基礎結構配置失敗

文件 沒有 system32 安裝oracle ces sts sha 技術分享 sys 安裝oracle rac,預檢查沒有問題,在安裝進行到100後,總是提示網格基礎結構失敗,原因為“插件的執行方法失敗”,反復嘗試,最後發現是hosts配置問題, 解決辦法:修改HOS

CentOS7 靜默安裝Oracle 11gR2(11.2.0.1)

文件的 sil swapon profile pytho ise sym 端口 啟動 最近有個項目需要遷移,項目中數據庫用的是oracle,期間折騰了好久,特此記錄。 一,下載Oracle 1,首先下載Oracle 11gR2,地址如下:http://www.oracle.

單實例12.2.0.1安裝

rod ipv it is def pdb dba term cnblogs 0.10 1. 修改用戶的SHELL的限制,vi /etc/security/limits.conf 文件,文件末尾添加修改如下oracle soft nproc

Oracle 10g 10.2.0.1 在Oracle Linux 5.4 32Bit RAC安裝手冊(一抹曦陽)

oracl track microsoft sun msu ica http net ref Oracle 10g 10.2.0.1 在Oracle Linux 5.4 32Bit RAC安裝手冊(一抹曦陽).pdf下載地址 ,step by step

關於安裝Oracle 11.2.0.1 RAC的筆記

domain yum driver 設置 ipv sun 創建 應用 sysconfig 這是第一次安裝RAC,參考了國外一位大神的安裝文檔,在安裝過程中,也遇到了一些問題,從網上查了相關問題的解決方法,在此感謝。 操作系統是 Oracle Enterprise Linux

1.1學習1.2約定1.3認識Linux1.4創虛擬機1.5安裝CentOS7

size mar 職位 重要 pad lis 設定 ans otto 1.1 學習之初一、給自己定位1、學這個課程的目的是什麽?2、學完之後要做什麽職位?3、學完之後要再哪個城市發展二、給自己設定一個目標1、何時學完?2、何時跳槽3、第一份薪資多少4、一年後多少,兩年後多少

在Centos6.9上安裝oracle11.2.0.4

blog 轉載 感謝 刪除數據 net 工具 clas 創建 sha 本文內容的來源包含並不限於如下幾位數據庫大神的視頻課堂或博客,由本人或原文轉載、或二次整理,在此由衷感謝! 小麥苗博客:http://blog.itpub.net/26736162/ 風哥博客:http:

Oracle GoldenGate 12.2.0.1 安裝、升級和刪除

OGG安裝 OGG升級 OGG刪除 OGG12.2 1、準備工作選擇正確的版本:OGG與數據庫廠商和數據庫版本對照表。 下載軟件:在Oracle Technology Network(OTN)或者使用CSI在 http://edelivery.oracle.com 中進行下載。 上傳軟件到服務

續:糾正:ubuntu【7.04】可以安裝,而且完美的安裝 ! for《Oracle-10.2.0.1,打補丁10.2.0.5:在 debian 版本4【不含4】以上,及 ubuntu 7.04【不含7.04】以上都可以安裝!》

etc ubun oracl poweroff ++ ldconfig red aio edi n次的測試後,最終證明,如下做法,可以完美安裝。 中間都不帶任何一個錯誤的!!!完美! dhclient vi /etc/profile ll cd /e

firefox 54.0.1版本安裝selenium IDE 2.9.1

firefox 56之後的版本不再支援匯出指令碼的操作,對於剛剛接觸自動化測試的新手來說,無疑非常不友好。本文介紹firefox 54.0.1版本安裝selenium IDE 2.9.1的流程。 第一步:下載firefox 54.0.1和selenium IDE 2.9.1,連結:https

離線安裝expat-2.0.1 ——安裝apr-util 遇到 expat.h: No such file or directory 的解決

在安裝apr-util-1.6.1 的過程中 ./configure --prefix=/usr/local/apr-util -with-apr=/usr/local/apr/bin/apr-1-config make 之後出現報錯 xml/ap

Atitit order algo 排序演算法 演算法道 目錄 1.1. 生活中常用的排序是插入排序和選擇排序 2 2. 0.1 演算法分類 2 3. .2 演算法複雜度 3 4. 十大經典排序演算法(動圖

Atitit order algo 排序演算法 演算法之道   目錄 1.1. 生活中常用的排序是插入排序和選擇排序 2 2. 0.1 演算法分類 2 3. .2 演算法複雜度 3 4. 十大經典排序演算法(動圖演示) 2 4 4.1. 0、演算法概述 2 4

RedHat7(CentOS)安裝Oracle12.2.0.1

yum -yinstall binutils compat-libcap1 compat-libstdc++-33 compat-libstdc++-33*.i686 elfutils-libelf-develgccgcc-c++ glibc*.i686 glibc glibc-devel glibc-