1. 程式人生 > >oracle把一份控制檔案複製多份常用的兩種方法

oracle把一份控制檔案複製多份常用的兩種方法

說明,所有的操作都是在一個節點操作,其他節點都是關閉狀態。
為了模擬測試,先把多個控制檔案變為一個
<==================
QL>
SQL> startup nomount;
ORACLE instance started.

Total System Global Area  584568832 bytes
Fixed Size                  2230552 bytes
Variable Size             322963176 bytes
Database Buffers          251658240 bytes
Redo Buffers                7716864 bytes
SQL> set lin 200
SQL> show parameter control

NAME                                 TYPE                              VALUE
------------------------------------ --------------------------------- ------------------------------
control_file_record_keep_time        integer                           7
control_files                        string                            +DATA/devdb/controlfile/curren
                                                                       t.260.940551955, +FLASH/devdb/
                                                                       controlfile/current.265.987359
                                                                       675
control_management_pack_access       string                            DIAGNOSTIC+TUNING
SQL>
SQL>


<=================先修改控制檔案個數為1個
SQL> alter system set control_files='+DATA/devdb/controlfile/current.260.940551955' scope=spfile;

System altered.

SQL> shutdown immediate;
ORA-01507: database not mounted


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

Total System Global Area  584568832 bytes
Fixed Size                  2230552 bytes
Variable Size             322963176 bytes
Database Buffers          251658240 bytes
Redo Buffers                7716864 bytes
Database mounted.
Database opened.
SQL>
SQL> set lin 200
SQL> show parameter control

NAME                                 TYPE                              VALUE
------------------------------------ --------------------------------- ------------------------------
control_file_record_keep_time        integer                           7
control_files                        string                            +DATA/devdb/controlfile/curren     《========當前控制檔案為一個
                                                                       t.260.940551955
control_management_pack_access       string                            DIAGNOSTIC+TUNING
SQL>

第一種方法
<===========修改控制檔案為兩份
1、首先檢查第二份控制檔案需要存放的路徑是否存在控制檔案
ASMCMD>
ASMCMD> pwd
+FLASH/DEVDB/CONTROLFILE
ASMCMD> ls
ASMCMD-8002: entry 'CONTROLFILE' does not exist in directory '+FLASH/DEVDB/'
ASMCMD>
ASMCMD>

2、生成第二份控制檔案
啟動到nomount狀態
SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL>
SQL>
SQL>
SQL> startup nomount;
ORACLE instance started.

Total System Global Area  584568832 bytes
Fixed Size                  2230552 bytes
Variable Size             322963176 bytes
Database Buffers          251658240 bytes
Redo Buffers                7716864 bytes
SQL>

使用rman 恢復第二份控制檔案
[[email protected]]$rman target /

Recovery Manager: Release 11.2.0.3.0 - Production on Thu Sep 20 18:45:37 2018

Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.

connected to target database: DEVDB (not mounted)

RMAN> restore controlfile to '+FLASH' from '+DATA/devdb/controlfile/current.260.940551955';

Starting restore at 2018/09/20 18:45:41
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=16 instance=devdb2 device type=DISK

channel ORA_DISK_1: copied control file copy
Finished restore at 2018/09/20 18:45:45

RMAN>

檢查控制檔案目錄是否已經生成檔案
ASMCMD> pwd
+FLASH/DEVDB/CONTROLFILE
ASMCMD> ls
current.265.987360343                    <=================
ASMCMD>


修改控制檔案control_files 引數
[[email protected]]$o

SQL*Plus: Release 11.2.0.3.0 Production on Thu Sep 20 18:47:27 2018

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


Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options

SQL> alter system set control_files='+DATA/devdb/controlfile/current.260.940551955','+FLASH/DEVDB/CONTROLFILE/current.265.987360343' scope=spfile;

System altered.

SQL>
SQL> shutdown immediate;
ORA-01507: database not mounted


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

Total System Global Area  584568832 bytes
Fixed Size                  2230552 bytes
Variable Size             322963176 bytes
Database Buffers          251658240 bytes
Redo Buffers                7716864 bytes
Database mounted.
Database opened.
SQL>
SQL> set lin 200
SQL> show parameter control

NAME                                 TYPE                              VALUE
------------------------------------ --------------------------------- ------------------------------
control_file_record_keep_time        integer                           7
control_files                        string                            +DATA/devdb/controlfile/curren
                                                                       t.260.940551955, +FLASH/devdb/
                                                                       controlfile/current.265.987360
                                                                       343
control_management_pack_access       string                            DIAGNOSTIC+TUNING
SQL> set wrap off
SQL> set lin 200
SQL> select *from v$controlfile;
rows will be truncated

rows will be truncated

rows will be truncated


STATUS                NAME
--------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
                      +DATA/devdb/controlfile/current.260.940551955
                      +FLASH/devdb/controlfile/current.265.987360343

SQL>

第二種方法

1、首先修改control_files

SQL>
SQL> select open_mode from v$database;

OPEN_MODE
------------------------------------------------------------
READ WRITE

SQL> show parameter control

NAME                                 TYPE
------------------------------------ ---------------------------------
VALUE
------------------------------
control_file_record_keep_time        integer
7
control_files                        string
+DATA/devdb/controlfile/curren
t.260.940551955
control_management_pack_access       string
DIAGNOSTIC+TUNING
SQL>
SQL>
SQL>
SQL> alter system set control_files='+DATA/devdb/controlfile/current.260.940551955','+FLASH' scope=spfile sid='*';

System altered.

SQL>
SQL>


<======啟動到nomount
SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL>
SQL> startup nomount;
ORACLE instance started.

Total System Global Area  584568832 bytes
Fixed Size                  2230552 bytes
Variable Size             322963176 bytes
Database Buffers          251658240 bytes
Redo Buffers                7716864 bytes
SQL> exit


<=====restore控制檔案

[[email protected]]$rman target /

Recovery Manager: Release 11.2.0.3.0 - Production on Thu Sep 20 19:23:25 2018

Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.

connected to target database: DEVDB (not mounted)

RMAN> restore controlfile from '+DATA/devdb/controlfile/current.260.940551955';

Starting restore at 2018/09/20 19:23:51
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=16 instance=devdb2 device type=DISK

channel ORA_DISK_1: copied control file copy
output file name=+DATA/devdb/controlfile/current.260.940551955
output file name=+FLASH/devdb/controlfile/current.263.987362633
Finished restore at 2018/09/20 19:23:58

RMAN> sql 'alter database mount';

sql statement: alter database mount
released channel: ORA_DISK_1

RMAN> sql 'alter database open';

sql statement: alter database open

RMAN> exit


Recovery Manager complete.
[[email protected]]$o

SQL*Plus: Release 11.2.0.3.0 Production on Thu Sep 20 19:25:02 2018

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


Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options

SQL> set lin 200
SQL> show parameter control

NAME                                 TYPE                              VALUE
------------------------------------ --------------------------------- ------------------------------
control_file_record_keep_time        integer                           7
control_files                        string                            +DATA/devdb/controlfile/curren
                                                                       t.260.940551955, +FLASH/devdb/
                                                                       controlfile/current.263.987362
                                                                       633
control_management_pack_access       string                            DIAGNOSTIC+TUNING
SQL>

<======參考資料
How To Move Controlfile To ASM [ID 468458.1]
How to duplicate a controlfile when ASM is involved [ID 345180.1]

相關推薦

oracle控制檔案複製常用方法

說明,所有的操作都是在一個節點操作,其他節點都是關閉狀態。 為了模擬測試,先把多個控制檔案變為一個 <================== QL> SQL> startup nomount; ORACLE instance started. Total S

初夏小談:C/C++防止標頭檔案被重複包含的方法及區別

防止標頭檔案被重複包含的兩種方式: 1.條件編譯的巨集 2.#pragma once 先來說說第一種: #ifndef __HEADNAME__H__ #define __HEADNAME__H__ //... //標頭檔案 #endif C/C++標準支援

怎麼橫版視訊剪成豎版?方法快速搞定!畫面滿屏,沒有黑邊

現在很多手機社交媒體上,都比較流行豎版視訊。那麼橫版視訊如何變成豎版?今天教大家兩種方法快速搞定!橫版改成豎屏,並且做到畫面滿屏,無黑邊。順便還會分享現在抖音、朋友圈、影視圈最流行的豎版視訊排版方式的製作技巧。 方法1:利用愛剪輯將橫版視訊剪成豎版,效果酷炫讓你立馬拿到超多贊 第一步:開

eclipse開啟當前檔案所在資料夾的方法

很鬱悶,現在的MyEclipse越來越大,越來越慢,沒辦法,打算迴歸Eclipse的懷抱,還好現在的Eclipse有很多功能可以直接替代Myeclipse.:) 先寫一個最常用的開啟資料夾吧。以後的等我總結了並證實好用了再說;)  如果你經常需要在Eclipse裡開啟相

Javascript獲取滑鼠的位置, 獲取Html控制元件的絕對位置的方法

 滑鼠遊標相對於目前區塊邊框的距離 event.offsetX、event.offsetY  滑鼠遊標相對於目前瀏覽器邊框的距離 event.clientX、event.clientY、event.x、event.y  滑鼠遊標相對於目前螢幕邊框的距離 event.scre

C# 防止程序開的方法

獲取 message 進程資源 信息 lse 多次 ase send true 互斥對象防止程序多開 private void Form1_Load(object sender, EventArgs e) { bool Exist;//定義一個bo

Oracle新增列,並複製資料,批量修改。

新增一列: alter table dt_ck_czry add( jszh varchar2(20) ) 給新增列新增資料: update dt_ck_czry set jszh = czy_dm; 將新增列中是字母的資料修改為空: update( select *

Oracle列的值合併為一個值並用逗號分隔

Oracle把一列的值合併為一個值,並用逗號分隔。例項中將把部門表(DEPT表)與員工表(EMP表)關聯,查詢每個部門下的所有員工姓名,員工姓名之間以逗號分隔(如圖一)。圖一:執行結果1、WMSYS.WM_CONCAT(列名)函式 介紹:其函式在Oracle 10g推出,在1

mysql欄位拆分為

一:資料庫 二:sql語句 select a.house_no as '房子',substring_index(substring_index(a.name,',',b.help_topic_id+1),',',-1) as '擁有者'  from  aa a join

Linux命令-cp 整個目錄下檔案複製到另一個目錄

在linux伺服器上想把一個檔案的檔案全部複製到另一個資料夾時,同時該資料夾下的檔案較多無法進行單個檔案的移動時,就要用cp命令         cp命令格式                                  cp  -r 源目錄/* 指定目錄      

Oracle 使用條insert語句完成表插入

語法一 全表插入 insert all into table1 values() into table2 values() select * from table 執行過後,會將table

Oracle:如何備份控制檔案?

 一、作業系統:Windows 2000   二、資料庫: Oracle 8i (8.1.7) for NT 企業版   三、安裝路徑:D:\ORACLE   實現方法:   1、   ALTER DATABASE BACKUP CONTROLFILE TO TRACE;   ALTER DATABASE B

oracle一個表的資料複製到另一個表中

1. 新增一個表,通過另一個表的結構和資料 create table XTHAME.tab1 as select * from DSKNOW.COMBDVERSION 2. 如果表存在: in

怎麼才能windows裡的檔案複製到虛擬機器的linux中去

進入你的虛擬機器中,然後,右擊你的虛擬機器的標籤,選擇設定-->options選項卡中有一個“共享資料夾”用滑鼠選中它,再在右邊視窗中,點新增按鈕,再在你的linux系統中作如下操作: cd /mnt/hgfs/<你的共享名> 在這裡面你就可以看到你的真實

將HTML頁面自動儲存為PDF檔案並上傳的方式()-前端(react)方式

一、業務場景   公司的樣本檢測報告以React頁面的形式生成,已調整為A4大小的樣式並已實現分頁,業務上需要將這個網頁生成PDF檔案,並上傳到伺服器,後續會將這個檔案傳送給客戶(這裡不考慮)。 二、原來的實現形式   瀏覽器原生方法:window.print()可以將網頁儲存為PDF檔案,由於檢測報告

Oracle備份歸檔日誌檔案方法比較

備份歸檔日誌方式有兩種:  1 單獨備份歸檔日誌:backup archivelog all  2 在執行備庫時一起備份歸檔日誌:backup database plus archivelog;  這兩種方式有什麼區別呢?  執行ba

codeforces 1058 D. Vasya and Triangle(已知面積求整數點座標,規律,利用__gcd個數拆成有範圍限制的個數相乘)

題意:給出橫座標最大值n,縱座標最大值m,再給出一個k要求,輸出三個整數點座標構成的三角形的面積為m*n/k 思路: (ps:利用__gcd把一個數拆成有範圍限制的兩個數相乘,不是對這個數的質因數貪心得去乘,湊那兩個範圍(這樣不行的) ) 令x1=y1=0 ,顯然

C#(.net)中的次連線資料庫執行條sql語句(方法)

第一種方法: string str="server=.;uid=sa;pwd=111111;database=text_db";//連線字串 SqlConnection SCON = null;//連線物件 SqlCommand SCom=new SqlCommand();/

[技術隨筆()] 檔案分割的方法

1 簡介 有時候我們需要將一個大檔案分成幾個小檔案,以便上傳或者放到U盤上,尤其是當單個檔案超過U盤的容量時,U盤再多也無濟於事,這個時候分割檔案就派上用場啦。檔案的分割有兩種方法:壓縮軟體分卷和分割軟體分割 2 工具 360壓縮 Hjsplit

Oracle匯出表(即DMP檔案)的方法

1:G:\Oracle\product\10.1.0\Client_1\NETWORK\ADMIN目錄下有個tnsname.ora檔案,內容如下: CMSTAR =   (DESCRIPTION =     (ADDRESS_LIST =       (ADDRESS = (PROTOCOL = TCP)