1. 程式人生 > >一個oracle 資料庫建立多個例項

一個oracle 資料庫建立多個例項

一個數據庫建立多個例項

1.      先要關閉資料庫(程序和記憶體關閉)

 [[email protected]_2 ~]$ sqlplus / as sysdba

SQL*Plus: Release 10.2.0.1.0 - Production on TueNov 12 20:34:53 2013

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

Connected to:

Oracle Database 10g Enterprise Edition Release10.2.0.1.0 - Production

With the Partitioning, OLAP and Data Mining options

SQL> shutdown immediate

Database closed.

Database dismounted.

ORACLE instance shut down.

SQL> exit

2.      設定環境變數

[[email protected]_2 ~]$ vi .bash_profile

此時環境變數已經設定好了

3.      建立目錄

         i.             建立相關檔案

此時我們可以看見已經有了相關目錄,那是我們之前建立的例項ORCL的相關目錄

   建立目錄是採用了批量建立目錄{a,b,c,u}dump

[[email protected]

_2 ~]$ cd $ORACLE_BASE

[[email protected]_2 oracle]$ ls

admin flash_recovery_area  oradata  oraInventory product

[[email protected]_2 oracle]$

[[email protected]_2 oracle]$ mkdir -p admin/ORA10G/{a,b,c,u}dump

[[email protected]_2 oracle]$ ls

admin flash_recovery_area  oradata  oraInventory product

[[email protected]_2 oracle]$ cd admin/

[[email protected]_2 admin]$ ls

ORA10G  ORCL

[[email protected]_2 admin]$ cd ORA10G/

[[email protected]_2 ORA10G]$ ls

adump bdump  cdump  udump

[[email protected]_2 ORA10G]$

[[email protected]_2 ORA10G]$ ls

adump bdump  cdump  udump

[[email protected]_2 ORA10G]$ cd ..

[[email protected]_2 admin]$ ls

ORA10G  ORCL

[[email protected]_2 admin]$ cd ..

[[email protected]_2 oracle]$ ls

admin flash_recovery_area  oradata  oraInventory product

[[email protected]_2 oracle]$ mkdir -p oradata/ORA10G

[[email protected]_2 oracle]$

       ii.             建立密碼檔案

  建立密碼檔案需要到ORACLE_HOME/dbs目錄下建立

[[email protected]_2 10.2.0]$ cd $ORACLE_HOME/dbs

[[email protected]_2 dbs]$ ls

hc_ORCL.dat initdw.ora  init.ora  lkORCL orapwORCL  spfileORCL.ora

[[email protected]_2 dbs]$ orapwd

Usage: orapwd file=<fname>password=<password> entries=<users> force=<y/n>

  where

    file -name of password file (mand),

    password- password for SYS (mand),

    entries -maximum number of distinct DBA and    force - whether to overwrite existing file (opt),

OPERs (opt),

  There areno spaces around the equal-to (=) character.

[[email protected]_2 dbs]$ orapwd file=orapwORA10Gpassword=oracle entries=30

[[email protected]_2 dbs]$ ls

hc_ORCL.dat init.ora  orapwORA10G  spfileORCL.ora

initdw.ora  lkORCL    orapwORCL

[[email protected]_2 dbs]$

[[email protected]_2 dbs]$ cat init.ora |grep -v^#|grep -v ^$ >initORA10G.ora

[[email protected]_2 dbs]$ ls

hc_ORCL.dat init.ora        lkORCL       orapwORCL

initdw.ora  initORA10G.ora  orapwORA10G  spfileORCL.ora

[[email protected]_2 dbs]$

[[email protected]_2 dbs]$ vi initORA10G.ora

將內容改的和下面的一樣

db_name=ORA10G

db_files = 80                                                        # SMALL 

db_file_multiblock_read_count = 8                                     #SMALL 

log_checkpoint_interval = 10000

processes = 50                                                        # SMALL 

parallel_max_servers = 5                                              #SMALL

log_buffer = 32768                                                   # SMALL

max_dump_file_size = 10240      # limit trace file size to 5 Meg each

global_names = false

control_files =(/u01/app/oracle/oradata/ORA10G/ora_control1.ctl,/u01/app/oracle/oradata/ORA10G/ora_control2.ctl)

sga_max_size=300m

sga_target=300m

4.      啟動例項為ORA10G的資料庫

[[email protected]_2 dbs]$ export $ORACLE_SID=ORA10G

[[email protected]_2 dbs]$ sqlplus / as sysdba

SQL*Plus: Release 10.2.0.1.0 - Production on TueNov 12 21:08:55 2013

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

Connected to an idle instance.

[email protected]>

[email protected]>create spfile from pfile;

File created.

[email protected]>startup nomount;

ORACLE instance started.

Total System Global Area  314572800 bytes

Fixed Size                  1219184 bytes

Variable Size              96470416 bytes

Database Buffers          213909504 bytes

Redo Buffers                2973696 bytes

[email protected]>

[email protected]>show parameter undo

NAME                                 TYPE        VALUE

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

undo_management                      string      MANUAL

undo_retention                       integer     900

undo_tablespace                      string

[email protected]>

修改引數,由於undo_management引數為靜態引數,所以需要加上scope=spfile

[email protected]>alter system set undo_management=autoscope=spfile;

System altered.

[email protected]>show parameter undo

NAME                                 TYPE        VALUE

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

undo_management                      string      MANUAL

undo_retention                       integer     900

undo_tablespace                      string

[email protected]>shutdown immediate

ORA-01507: database not mounted

ORACLE instance shut down.

     此時發現並沒有更改,是由於靜態引數需要重啟才有效

[email protected]>startup nomount;

ORACLE instance started.

Total System Global Area  314572800 bytes

Fixed Size                  1219184 bytes

Variable Size              96470416 bytes

Database Buffers          213909504 bytes

Redo Buffers                2973696 bytes

[email protected]>

     此時只是改了spfile的引數還需要改pfile的引數

[email protected]>create pfile from spfile;

File created.

[email protected]>

5.      多個例項的切換

          i.             例項為ORCL啟動資料庫

[[email protected]_2 dbs]$ export ORACLE_SID=ORCL

[[email protected]_2 dbs]$ sqlplus / as sysdba

SQL*Plus: Release 10.2.0.1.0 - Production on TueNov 12 21:19:19 2013

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

Connected to an idle instance.

[email protected]>

        ii.             例項為ORCL10G啟動資料庫

[email protected]>exit

Disconnected

[[email protected]_2 dbs]$ export ORACLE_SID=ORA10G

[[email protected]_2 dbs]$ sqlplus / as sysdba

SQL*Plus: Release 10.2.0.1.0 - Production on TueNov 12 21:24:54 2013

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

Connected to:

Oracle Database 10g Enterprise Edition Release10.2.0.1.0 - Production

With the Partitioning, OLAP and Data Mining options

[email protected]>

相關推薦

一個oracle 資料庫建立例項

一個數據庫建立多個例項 1.      先要關閉資料庫(程序和記憶體關閉)  [[email protected]_2 ~]$ sqlplus / as sysdba SQL*Plus: Release 10.2.0.1.0 - Production on Tu

mycat接oracle和mysql例項

Mycat 後面接一個Oracle例項與一個MySQL例項,假設使用者表,訂單表,轉賬記錄表,Oracle字符集為GBK的,MySQL字符集則要求UTF8的完成使用者表與訂單表到MySQL的遷移過程,要求導資料是通過命令列連線Mycat來完成的 oraclescott/[email protect

web專案Log4j日誌輸出路徑配置問題 問題描述:一個web專案想在一個tomcat下執行例項(通過修改war包名稱的實現),然後每個例項都將日誌輸出到tomcat的logs目錄下例項名命名的文

問題描述:一個web專案想在一個tomcat下執行多個例項(通過修改war包名稱的實現),然後每個例項都將日誌輸出到tomcat的logs目錄下例項名命名的資料夾下進行區分檢視每個例項日誌,要求通過儘可能少的改動配置檔案,最好修改例項名後可以不修改log4j的配置檔案。 實現分析:一般實現上面需求,需要在修

TCP server 為什麼一個埠可以建立連線?

轉自segment fault TCP server 可以,TCP client 也可以。一個套接字只能建立一個連線,無論對於 server 還是 client。 注意報錯訊息是: [Errno 106] (EISCONN) Transport en

centOS7下redis3.0安裝以及佈置叢集教程(單機建立例項除錯)

版本說明 本教程使用redis3.0版本。3.0版本主要增加了redis叢集功能。 安裝的前提條件 需要安裝gcc:yuminstall gcc-c++(如果你的Linux環境下已經裝過了Nginx,此處可忽略,因為Nginx也需要gcc環境才能安裝) 原始碼下載:此處

一個Xcode頁面建立工程

Xcode裡面是可以同時存在多個工程的。可以通過存放在同一個工作空間來實現同一個Xcode頁面存在多個工程,也就是有多個xcodeproj。如下圖所示。 在Xcode頁面中管理3個工程 這樣不僅可以方便管理幾個相似功能的工程,更重要的是,可以實現多工程聯編。 接下來我們

SQL2005建立例項經驗

1.跟正常安裝SQL2005一樣。但要注意的是安裝其他例項時,安裝選項裡只要選擇最基本的SQL Server Database Services即可; 2.安裝時必須取一個名字,不能使用預設例項了; 3.安裝後必須指定另外一個埠,預設埠為1433,其他例項不能再使用這個埠,

建立Oracle資料庫及相應的例項

對於使用過SQL Server資料庫的使用者可以會對Oracle中的資料庫的例項的概念理解的不是很好,所以我產生了寫一篇博文的想法。 基礎概念 一般Oracle資料庫(Oracle Database)可以分為兩部分,即例項(Instance)和資料庫(Database)。

一個MySql例項自動建立Activiti資料庫問題

一次使用SSH和Activiti6開發的專案中,在伺服器啟動的時候就報錯:org.apache.ibatis.exceptions.PersistenceException: ### Error querying database.  Cause: java.sql.SQLS

oracle資料庫例項配置

listener.ora  配置》》》》 SID_LIST_LISTENER =   (SID_LIST =     (SID_DESC =       (GLOBAL_DBNAME = orcl)       (ORACLE_HOME = F:\app\Administr

TCP server 為什麽一個端口可以建立連接?

tab 建立 傳輸 grep not ide 技術分享 什麽 circle https://segmentfault.com/q/1010000003101541 如果是tcp client用同一個本地端口去連不同的兩個服務器ip,連第二個時就會提示端口已被占用。但服務

windows環境建立redis例項,實現主從同步

redis單機環境下開啟多個例項,並形成主從同步。redis預設埠是6379,這裡我們建立了三個例項,分別使用了6380,6381,6382三個埠,6380埠例項作為主節點,6381和6382作為從節點。 1.下載好windows版本的redis,進行解壓。這裡並沒有安裝為windows的服務,

【Vue.js學習筆記】8:建立Vue例項物件,認識Vue中的元件

建立多個Vue例項物件 這裡在同一個js檔案中建立了兩個Vue例項物件,它們各自能完成前面學的那些功能,同時使用物件名稱也可以互相訪問,協同實現一些功能。 index.html <!DOCTYPE html> <html lang="en" xmlns:v-

如何使一個Spring Boot專案啟動例項

應用場景:使用Ribbon的@LoadBalanced註解來實現服務端的負載均衡消費Spring Boot專案啟動多個工程例項,即一個專案,修改一個埠啟動一個服務,修改完配置檔案(application.properties、application.yml)即可,按照如下操作

ORACLE 11g在linux上建立第二例項

linux伺服器主機不夠,而測試人員需要新的一臺oracle環境做測試,,所以準備在已經有的oracle的linux主機上上面建立第二個例項。這臺oracle伺服器的資源足夠用,所以就直接在上面搭建多例項來滿足測試人員的需求。 1,使用vnc 遠端工具進去

關於ORACLE資料庫名以及資料例項名等幾重要概念

在Oracle中有關資料庫和資料庫例項的幾個重要概念,有時候如果理解不是很深或者對其疏忽、混淆了,還真容易搞錯或弄不清其概念,下面就資料庫例項名、資料庫名、資料庫域名、資料庫服務名、全域性資料庫名幾個概念,我們來梳理一下概念,總結歸納一下這些知識,首先,我們來看看官方文件對這幾者的概念介紹:  

程式碼:編寫一個簡單的字元裝置驅動——建立同類型裝置

編寫同類型多個裝置字元驅動應注意一下幾個問題: 1、申請裝置號alloc_chrdev_region時須指定次裝置號範圍; 2、動態分配裝置空間時同時分配NUM個裝置的空間; 3、根據次裝置號和統一的主裝置號生成針對單個裝置的devno,然後完成cdev_add註冊; 4、

oracle一個表的欄位更新另一個表對應的欄位

update wx_weather a set (a.high_l,a.low_l)= (select high_l, low_l from wx_original_weather b where a

android studio在一個資料夾下建立module(libraray)

每次開發專案都會引入一些第三方支援庫,而在android studio下它們都是作為module的形式存在一個專案中,太多的話難免看起來很亂,所以萌生了把他們放在同一個資料夾下的想法,也就是

oracle主鍵自增 建立觸發器

問題: 最近修改專案的sql指令碼,新增幾張表,其中三個表需要屬性自增,mySql中可以直接用AUTO_INCREMENT,oracle沒有做自增功能,需要手動寫觸發器實現自增功能。在網上找到了解決方案。貼出來供大家參考: 解決方案:1.首先建立表 CREATE TABL