【12c】RMAN 與 DataGuard

来源:https://www.cnblogs.com/alen-liu-sz/archive/2020/05/27/12975553.html
-Advertisement-
Play Games

由於主庫和備庫的db_name相同的,只是db_unique_name不同,可以使用備庫進行資料庫的備份,從而減輕主庫備份的負擔。本篇演示DataGuard環境下RMAN工具的使用。 1 查看主庫RMAN配置 [oracle@sz ~]$ rman target / catalog rman/rma ...


由於主庫和備庫的db_name相同的,只是db_unique_name不同,可以使用備庫進行資料庫的備份,從而減輕主庫備份的負擔。本篇演示DataGuard環境下RMAN工具的使用。

1 查看主庫RMAN配置

[oracle@sz ~]$ rman target / catalog rman/rman@catdb



Recovery Manager: Release 12.1.0.2.0 - Production on Sun Apr 26 21:49:56 2020



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



connected to target database: ORCL (DBID=1565938253)

connected to recovery catalog database



RMAN> show all;



RMAN configuration parameters for database with db_unique_name ORCL are:

CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 7 DAYS;

CONFIGURE BACKUP OPTIMIZATION OFF; # default

CONFIGURE DEFAULT DEVICE TYPE TO DISK; # default

CONFIGURE CONTROLFILE AUTOBACKUP OFF; # default

CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '%F'; # default

CONFIGURE DEVICE TYPE DISK PARALLELISM 1 BACKUP TYPE TO BACKUPSET; # default

CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default

CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default

CONFIGURE MAXSETSIZE TO UNLIMITED; # default

CONFIGURE ENCRYPTION FOR DATABASE OFF; # default

CONFIGURE ENCRYPTION ALGORITHM 'AES128'; # default

CONFIGURE COMPRESSION ALGORITHM 'BASIC' AS OF RELEASE 'DEFAULT' OPTIMIZE FOR LOAD TRUE ; # default

CONFIGURE DB_UNIQUE_NAME 'orcl' CONNECT IDENTIFIER 'shzhen';

CONFIGURE DB_UNIQUE_NAME 'orcldg' CONNECT IDENTIFIER 'shhai';

CONFIGURE RMAN OUTPUT TO KEEP FOR 7 DAYS; # default

CONFIGURE ARCHIVELOG DELETION POLICY TO APPLIED ON ALL STANDBY;

CONFIGURE SNAPSHOT CONTROLFILE NAME TO '/u01/app/oracle/product/12.1.0/dbhome_1/dbs/snapcf_orcl.f'; # default



RMAN>

2 查看備庫RMAN配置

[oracle@sh ~]$ rman target / catalog rman/rman@catdb



Recovery Manager: Release 12.1.0.2.0 - Production on Sun Apr 26 21:50:16 2020



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



connected to target database: ORCL (DBID=1565938253)

connected to recovery catalog database



RMAN> show all;



RMAN configuration parameters for database with db_unique_name ORCLDG are:

CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 7 DAYS;

CONFIGURE BACKUP OPTIMIZATION OFF; # default

CONFIGURE DEFAULT DEVICE TYPE TO DISK; # default

CONFIGURE CONTROLFILE AUTOBACKUP ON;

CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '%F'; # default

CONFIGURE DEVICE TYPE DISK PARALLELISM 1 BACKUP TYPE TO BACKUPSET; # default

CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default

CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default

CONFIGURE MAXSETSIZE TO UNLIMITED; # default

CONFIGURE ENCRYPTION FOR DATABASE OFF; # default

CONFIGURE ENCRYPTION ALGORITHM 'AES128'; # default

CONFIGURE COMPRESSION ALGORITHM 'BASIC' AS OF RELEASE 'DEFAULT' OPTIMIZE FOR LOAD TRUE ; # default

CONFIGURE DB_UNIQUE_NAME 'orcl' CONNECT IDENTIFIER 'shzhen';

CONFIGURE DB_UNIQUE_NAME 'orcldg' CONNECT IDENTIFIER 'shhai';

CONFIGURE RMAN OUTPUT TO KEEP FOR 7 DAYS; # default

CONFIGURE ARCHIVELOG DELETION POLICY TO NONE; # default

CONFIGURE SNAPSHOT CONTROLFILE NAME TO '/u01/app/oracle/product/12.1.0/dbhome_1/dbs/snapcf_orcldg.f'; # default



RMAN>

3 備庫進行資料庫的備份

對主備用資料庫進行RMAN配置後,接下來就可以將物理備庫作為RMAN的目標資料庫進行連接,將原來在主庫上的備份操作完全移至備庫。由於備庫本質上是主庫的物理副本,因此,不論在主庫備份,還是在備庫備份,在恢復和還原資料庫時,兩者時通用的、可以互換的,但需註意的是,在RMAN中查看和管理備份時,它們還是和dB_UNIQUE_NAME相關聯的。

[oracle@sh ~]$ rman target sys/system@shhai catalog rman/rman@catdb



Recovery Manager: Release 12.1.0.2.0 - Production on Sun Apr 26 22:49:07 2020



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



connected to target database: ORCL (DBID=1565938253)

connected to recovery catalog database



RMAN> backup database plus archivelog;





Starting backup at 26-APR-20

current log archived at primary database

allocated channel: ORA_DISK_1

channel ORA_DISK_1: SID=21 device type=DISK

channel ORA_DISK_1: starting archived log backup set

channel ORA_DISK_1: specifying archived log(s) in backup set

input archived log thread=1 sequence=12 RECID=1 STAMP=1038160947

input archived log thread=1 sequence=13 RECID=2 STAMP=1038160948

input archived log thread=1 sequence=14 RECID=3 STAMP=1038161310

input archived log thread=1 sequence=15 RECID=4 STAMP=1038161793

input archived log thread=1 sequence=16 RECID=5 STAMP=1038164237

input archived log thread=1 sequence=17 RECID=7 STAMP=1038341915

input archived log thread=1 sequence=18 RECID=6 STAMP=1038341913

input archived log thread=1 sequence=19 RECID=8 STAMP=1038344530

input archived log thread=1 sequence=20 RECID=9 STAMP=1038344716

input archived log thread=1 sequence=21 RECID=11 STAMP=1038345256

input archived log thread=1 sequence=22 RECID=13 STAMP=1038351398

input archived log thread=1 sequence=23 RECID=16 STAMP=1038351676

input archived log thread=1 sequence=24 RECID=18 STAMP=1038351701

input archived log thread=1 sequence=25 RECID=17 STAMP=1038351701

input archived log thread=1 sequence=26 RECID=19 STAMP=1038768564

input archived log thread=1 sequence=27 RECID=20 STAMP=1038768690

input archived log thread=1 sequence=28 RECID=21 STAMP=1038768781

input archived log thread=1 sequence=29 RECID=22 STAMP=1038768877

input archived log thread=1 sequence=30 RECID=23 STAMP=1038772825

input archived log thread=1 sequence=31 RECID=24 STAMP=1038782819

input archived log thread=1 sequence=32 RECID=25 STAMP=1038782819

input archived log thread=1 sequence=33 RECID=26 STAMP=1038782826

input archived log thread=1 sequence=34 RECID=27 STAMP=1038782922

input archived log thread=1 sequence=35 RECID=28 STAMP=1038782959

channel ORA_DISK_1: starting piece 1 at 26-APR-20

channel ORA_DISK_1: finished piece 1 at 26-APR-20

piece handle=/u01/app/oracle/fast_recovery_area/ORCLDG/backupset/2020_04_26/o1_mf_annnn_TAG20200426T224922_hbc7vlqf_.bkp tag=TAG20200426T224922 comment=NONE

channel ORA_DISK_1: backup set complete, elapsed time: 00:00:07

Finished backup at 26-APR-20



Starting backup at 26-APR-20

using channel ORA_DISK_1

channel ORA_DISK_1: starting full datafile backup set

channel ORA_DISK_1: specifying datafile(s) in backup set

input datafile file number=00005 name=/u01/app/oracle/oradata/orcldg/example01.dbf

input datafile file number=00001 name=/u01/app/oracle/oradata/orcldg/system01.dbf

input datafile file number=00003 name=/u01/app/oracle/oradata/orcldg/sysaux01.dbf

input datafile file number=00004 name=/u01/app/oracle/oradata/orcldg/undotbs01.dbf

input datafile file number=00006 name=/u01/app/oracle/oradata/orcldg/users01.dbf

channel ORA_DISK_1: starting piece 1 at 26-APR-20

channel ORA_DISK_1: finished piece 1 at 26-APR-20

piece handle=/u01/app/oracle/fast_recovery_area/ORCLDG/backupset/2020_04_26/o1_mf_nnndf_TAG20200426T224929_hbc7vtob_.bkp tag=TAG20200426T224929 comment=NONE

channel ORA_DISK_1: backup set complete, elapsed time: 00:01:26

Finished backup at 26-APR-20



Starting backup at 26-APR-20

current log archived at primary database

using channel ORA_DISK_1

channel ORA_DISK_1: starting archived log backup set

channel ORA_DISK_1: specifying archived log(s) in backup set

input archived log thread=1 sequence=36 RECID=29 STAMP=1038783056

channel ORA_DISK_1: starting piece 1 at 26-APR-20

channel ORA_DISK_1: finished piece 1 at 26-APR-20

piece handle=/u01/app/oracle/fast_recovery_area/ORCLDG/backupset/2020_04_26/o1_mf_annnn_TAG20200426T225059_hbc7ympo_.bkp tag=TAG20200426T225059 comment=NONE

channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01

Finished backup at 26-APR-20



Starting Control File and SPFILE Autobackup at 26-APR-20

piece handle=/u01/app/oracle/fast_recovery_area/ORCLDG/autobackup/2020_04_26/o1_mf_s_1038782959_hbc7ynyn_.bkp comment=NONE

Finished Control File and SPFILE Autobackup at 26-APR-20



RMAN>

4 模擬主庫故障,恢復主庫

4.1 有備份,刪除主庫數據文件,進行恢復

1)刪除數據文件

[oracle@sz ~]$ cd /u01/app/oracle/oradata/orcl/

[oracle@sz orcl]$ ll

total 3362568

-rw-r----- 1 oracle asmadmin 10076160 Apr 26 22:53 control01.ctl

-rw-r----- 1 oracle asmadmin 1304174592 Apr 26 22:49 example01.dbf

-rw-r----- 1 oracle asmadmin 52429312 Apr 26 22:50 redo01.log

-rw-r----- 1 oracle asmadmin 52429312 Apr 26 22:53 redo02.log

-rw-r----- 1 oracle asmadmin 52429312 Apr 26 22:49 redo03.log

-rw-r----- 1 oracle asmadmin 52429312 Apr 21 23:00 redo04.log

-rw-r----- 1 oracle asmadmin 52429312 Apr 21 23:01 redo05.log

-rw-r----- 1 oracle asmadmin 52429312 Apr 21 23:01 redo06.log

-rw-r----- 1 oracle asmadmin 52429312 Apr 21 23:01 redo07.log

-rw-r----- 1 oracle asmadmin 744497152 Apr 26 22:49 sysaux01.dbf

-rw-r----- 1 oracle asmadmin 838868992 Apr 26 22:49 system01.dbf

-rw-r----- 1 oracle asmadmin 206577664 Apr 26 19:00 temp01.dbf

-rw-r----- 1 oracle asmadmin 167780352 Apr 26 22:49 undotbs01.dbf

-rw-r----- 1 oracle asmadmin 5251072 Apr 26 22:49 users01.dbf

[oracle@sz orcl]$ rm users01.dbf

2)資料庫出錯

[oracle@sz orcl]$ sqlplus scott/scott@shzhen



SQL*Plus: Release 12.1.0.2.0 Production on Sun Apr 26 22:54:17 2020



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





Connected to:

Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production

With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options



SQL> select count(1) from scott.emp;

select count(1) from scott.emp

*

ERROR at line 1:

ORA-01116: error in opening database file 6

ORA-01110: data file 6: '/u01/app/oracle/oradata/orcl/users01.dbf'

ORA-27041: unable to open file

Linux-x86_64 Error: 2: No such file or directory

Additional information: 3

3)查看備份信息

[oracle@sz ~]$ rman target / catalog rman/rman@catdb



Recovery Manager: Release 12.1.0.2.0 - Production on Sun Apr 26 22:55:30 2020



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



connected to target database: ORCL (DBID=1565938253)

connected to recovery catalog database



RMAN> list backup summary;



specification does not match any backup in the repository



RMAN> list backup summary for db_unique_name orcldg;



List of Backups for database with db_unique_name ORCLDG

===============

Key TY LV S Device Type Completion Time #Pieces #Copies Compressed Tag

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

621 B A A DISK 26-APR-20 1 1 NO TAG20200426T224922

654 B F A DISK 26-APR-20 1 1 NO TAG20200426T224929

691 B A A DISK 26-APR-20 1 1 NO TAG20200426T225059

692 B F A DISK 26-APR-20 1 1 NO TAG20200426T225100



RMAN> list backupset 654 for db_unique_name orcldg;



List of Backup Set for database with db_unique_name ORCLDG

===================





BS Key Type LV Size Device Type Elapsed Time Completion Time

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

654 Full 1.42G DISK 00:01:18 26-APR-20

BP Key: 679 Status: AVAILABLE Compressed: NO Tag: TAG20200426T224929

Piece Name: /u01/app/oracle/fast_recovery_area/ORCLDG/backupset/2020_04_26/o1_mf_nnndf_TAG20200426T224929_hbc7vtob_.bkp

List of Datafiles in backup set 654

File LV Type Ckp SCN Ckp Time Name

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

1 Full 2222976 26-APR-20 /u01/app/oracle/oradata/orcl/system01.dbf

3 Full 2222976 26-APR-20 /u01/app/oracle/oradata/orcl/sysaux01.dbf

4 Full 2222976 26-APR-20 /u01/app/oracle/oradata/orcl/undotbs01.dbf

5 Full 2222976 26-APR-20 /u01/app/oracle/oradata/orcl/example01.dbf

6 Full 2222976 26-APR-20 /u01/app/oracle/oradata/orcl/users01.dbf



RMAN> catalog backuppiece '/home/oracle/o1_mf_nnndf_TAG20200426T224929_hbc7vtob_.bkp';



cataloged backup piece

backup piece handle=/home/oracle/o1_mf_nnndf_TAG20200426T224929_hbc7vtob_.bkp RECID=2 STAMP=1038785184

List of Backups

===============

Key TY LV S Device Type Completion Time #Pieces #Copies Compressed Tag

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

621 B A A DISK 26-APR-20 1 1 NO TAG20200426T224922

654 B F A DISK 26-APR-20 1 1 NO TAG20200426T224929

4)還原數據文件

RMAN> restore datafile 6 from tag='TAG20200426T224929';



Starting restore at 26-APR-20

allocated channel: ORA_DISK_1

channel ORA_DISK_1: SID=24 device type=DISK



channel ORA_DISK_1: starting datafile backup set restore

channel ORA_DISK_1: specifying datafile(s) to restore from backup set

channel ORA_DISK_1: restoring datafile 00006 to /u01/app/oracle/oradata/orcl/users01.dbf

channel ORA_DISK_1: reading from backup piece /home/oracle/o1_mf_nnndf_TAG20200426T224929_hbc7vtob_.bkp

channel ORA_DISK_1: piece handle=/home/oracle/o1_mf_nnndf_TAG20200426T224929_hbc7vtob_.bkp tag=TAG20200426T224929

channel ORA_DISK_1: restored backup piece 1

channel ORA_DISK_1: restore complete, elapsed time: 00:00:01

Finished restore at 26-APR-20



RMAN> recover datafile 6;



Starting recover at 26-APR-20

using channel ORA_DISK_1



starting media recovery

media recovery complete, elapsed time: 00:00:01



Finished recover at 26-APR-20



RMAN> alter database open;



Statement processed

5)查看還原後的文件

[oracle@sz orcl]$ ll users01.dbf

-rw-r----- 1 oracle asmadmin 5251072 Apr 26 23:28 users01.dbf

4.2 無備份,刪除主庫數據文件,進行恢復

1)主備庫均無備份可用

[oracle@sz ~]$ rman target / catalog rman/rman@catdb



Recovery Manager: Release 12.1.0.2.0 - Production on Sun Apr 26 23:33:28 2020



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



connected to target database: ORCL (DBID=1565938253)

connected to recovery catalog database



RMAN> list backup for db_unique_name orcl;



specification does not match any backup in the repository



RMAN> list backup for db_unique_name orcldg;



specification does not match any backup in the repository

2)刪除數據文件

[oracle@sz orcl]$ rm users01.dbf

[oracle@sz orcl]$ ll users01.dbf

ls: cannot access users01.dbf: No such file or directory

3)啟動資料庫出錯

SQL> startup

ORACLE instance started.



Total System Global Area 1644167168 bytes

Fixed Size 2925024 bytes

Variable Size 973082144 bytes

Database Buffers 654311424 bytes

Redo Buffers 13848576 bytes

Database mounted.

ORA-01157: cannot identify/lock data file 6 - see DBWR trace file

ORA-01110: data file 6: '/u01/app/oracle/oradata/orcl/users01.dbf'

4)利用物理備庫的數據文件還原主庫損壞的數據文件

在RMAN中將備庫作為目標資料庫,將主庫作為輔助資料庫連接,同時連接恢複目錄。

[oracle@sh ~]$ rman target sys/system@shhai auxiliary sys/system@shzhen catalog rman/rman@catdb



Recovery Manager: Release 12.1.0.2.0 - Production on Sun Apr 26 23:37:03 2020



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



connected to target database: ORCL (DBID=1565938253)

connected to recovery catalog database

connected to auxiliary database: ORCL (DBID=1565938253, not open)



RMAN> backup as copy datafile 6 auxiliary format '/home/oracle/users_from_std.dbf';



Starting backup at 26-APR-20

allocated channel: ORA_DISK_1

channel ORA_DISK_1: SID=37 device type=DISK

channel ORA_DISK_1: starting datafile copy

input datafile file number=00006 name=/u01/app/oracle/oradata/orcldg/users01.dbf

output file name=/home/oracle/users_from_std.dbf tag=TAG20200426T233826

channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:01

Finished backup at 26-APR-20

5)在主庫註冊獲得的文件複製(可選)

[oracle@sz ~]$ rman target / catalog rman/rman@catdb



Recovery Manager: Release 12.1.0.2.0 - Production on Sun Apr 26 23:41:14 2020



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



connected to target database: ORCL (DBID=1565938253, not open)

connected to recovery catalog database



RMAN> catalog datafilecopy '/home/oracle/users_from_std.dbf';



cataloged datafile copy

datafile copy file name=/home/oracle/users_from_std.dbf RECID=1 STAMP=1038786100

6)利用已註冊的數據文件拷貝還原損壞的數據文件(可選)

RMAN> restore datafile 6;



Starting restore at 26-APR-20

allocated channel: ORA_DISK_1

channel ORA_DISK_1: SID=26 device type=DISK



channel ORA_DISK_1: restoring datafile 00006

input datafile copy RECID=1 STAMP=1038786100 file name=/home/oracle/users_from_std.dbf

destination for restore of datafile 00006: /u01/app/oracle/oradata/orcl/users01.dbf

channel ORA_DISK_1: copied datafile copy of datafile 00006

output file name=/u01/app/oracle/oradata/orcl/users01.dbf RECID=0 STAMP=0

Finished restore at 26-APR-20

或者直接利用下麵的命令:

RMAN> run{

2> set newname for datafile 6 to '/home/oracle/users_from_std.dbf';

3> switch datafile 6;

4> }



executing command: SET NEWNAME



datafile 6 switched to datafile copy

input datafile copy RECID=1 STAMP=1038786100 file name=/home/oracle/users_from_std.dbf

starting full resync of recovery catalog

full resync complete

7)恢復損壞的數據文件,打開資料庫

RMAN> recover datafile 6 ;



Starting recover at 26-APR-20

using channel ORA_DISK_1



starting media recovery

media recovery complete, elapsed time: 00:00:00



Finished recover at 26-APR-20



RMAN> alter database open;



Statement processed

4.3 利用網路進行恢復(12c新特性)

1)刪除數據文件

[oracle@sz ~]$ rm users_from_std.dbf

2)連接到主庫

[oracle@sz ~]$ rman target / catalog rman/rman@catdb



Recovery Manager: Release 12.1.0.2.0 - Production on Sun Apr 26 23:49:41 2020



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



connected to target database: ORCL (DBID=1565938253)

connected to recovery catalog database

3)設置加密演算法

RMAN> set encryption algorithm 'AES128';



executing command: SET encryption

4)利用備庫恢復主庫

RMAN> restore datafile '/home/oracle/users_from_std.dbf'

2> from service 'shhai' section size 120M;



Starting restore at 26-APR-20

allocated channel: ORA_DISK_1

channel ORA_DISK_1: SID=22 device type=DISK



channel ORA_DISK_1: starting datafile backup set restore

channel ORA_DISK_1: using network backup set from service shhai

channel ORA_DISK_1: specifying datafile(s) to restore from backup set

channel ORA_DISK_1: restoring datafile 00006 to /home/oracle/users_from_std.dbf

channel ORA_DISK_1: restoring section 1 of 1

channel ORA_DISK_1: restore complete, elapsed time: 00:00:01

Finished restore at 26-APR-20



RMAN> alter database open;



RMAN-00571: ===========================================================

RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============

RMAN-00571: ===========================================================

RMAN-03002: failure of sql statement command at 04/26/2020 23:53:33

ORA-01113: file 6 needs media recovery

ORA-01110: data file 6: '/home/oracle/users_from_std.dbf'



RMAN> recover datafile 6;



Starting recover at 26-APR-20

using channel ORA_DISK_1



starting media recovery

media recovery complete, elapsed time: 00:00:00



Finished recover at 26-APR-20



RMAN> alter database open;



Statement processed



RMAN> select count(1) from scott.emp;



COUNT(1)

----------

14

以上就是DataGuard環境下使用RMAN進行資料庫備份和恢復的演示。


您的分享是我們最大的動力!

-Advertisement-
Play Games
更多相關文章
  • 上一篇文章我寫了 Nginx 的 11 個階段,很多人都說太長了。這是出於文章完整性的考慮的,11 個階段嘛,一次性說完就完事了。今天這篇文章比較短,看完沒問題。 過濾模塊的位置 之前我們介紹了 Nginx 的 11 個階段,在 content 階段時,Nginx 會生成返回給用戶的響應內容,對用戶 ...
  • 下麵我們就來安裝Linux操作系統吧~ 首先你得確認自己有沒有下好ISO鏡像文件,就是下圖這個東西 然後打開虛擬機,找到虛擬機設置, 啟動虛擬機,選擇install Centos7 一直按回車鍵,進入光碟檢測界面,按ESC跳過檢測 來到選擇語言界面,這裡選擇English 下一步後,來到 instl ...
  • 可以使用Oracle內置的程式包DBMS_STATS來查看或修改搜集的資料庫統計信息,本篇主要介紹GATHER_TABLE_STATS過程,通過該過程,可以搜集表和列(或索引)的統計信息。 1 語法 dbms_stats.gather_table_stats(ownname varchar2, ta ...
  • 在Oracle資料庫中,優化器欲產生最優的執行計劃,需要依賴於相關對象的統計信息的搜集。資料庫可以自動的搜集執行計劃,也可以使用程式包DBMS_STATS進行手動搜集,本篇對常規統計信息的搜集不做說明,重點演示下關於擴展的統計信息(Extended Statistics)的的搜集。 1 擴展的統計信 ...
  • 直方圖,一種特殊類型的列的統計信息,它能提供表中列的更詳細的數據分佈信息,直方圖將值存放於桶(buckets)中。基於不同值的數目和數據的分佈,資料庫選擇要創建的直方圖類型,直方圖的類型有如下幾種: 頻率直方圖和頂頻直方圖:Frequency histograms and to frequency ...
  • 問題描述: 在Grid環境中,如果修改了主機名,啟動Grid時會出現如下錯誤: [grid@sztest ~]$ sqlplus / as sysasm SQL*Plus: Release 12.1.0.2.0 Production on Wed Apr 15 20:42:27 2020 Copyr ...
  • SRVCTL,服務控制實用工具(Service Control Utility),可用於對Oracle Restart和Oracle RAC的配置和管理,本篇主要介紹SRVCTL命令在Oracle Restart中的應用,其中,詳細介紹config、status命令,併列出其它命令的用法。 1 sr ...
  • Data Guard環境中資料庫的角色轉換有兩種,分別為Switchover和Failover,通過名稱可知,前者是正常的主備庫之間的角色切換,該切換方式不會丟失數據;後者是故障切換,即主庫不能繼續提供服務的切換,可能發生數據丟失。從12.1版本開始,切換到物理備庫的操作得以簡化,本篇分別對這兩種切 ...
一周排行
    -Advertisement-
    Play Games
  • 移動開發(一):使用.NET MAUI開發第一個安卓APP 對於工作多年的C#程式員來說,近來想嘗試開發一款安卓APP,考慮了很久最終選擇使用.NET MAUI這個微軟官方的框架來嘗試體驗開發安卓APP,畢竟是使用Visual Studio開發工具,使用起來也比較的順手,結合微軟官方的教程進行了安卓 ...
  • 前言 QuestPDF 是一個開源 .NET 庫,用於生成 PDF 文檔。使用了C# Fluent API方式可簡化開發、減少錯誤並提高工作效率。利用它可以輕鬆生成 PDF 報告、發票、導出文件等。 項目介紹 QuestPDF 是一個革命性的開源 .NET 庫,它徹底改變了我們生成 PDF 文檔的方 ...
  • 項目地址 項目後端地址: https://github.com/ZyPLJ/ZYTteeHole 項目前端頁面地址: ZyPLJ/TreeHoleVue (github.com) https://github.com/ZyPLJ/TreeHoleVue 目前項目測試訪問地址: http://tree ...
  • 話不多說,直接開乾 一.下載 1.官方鏈接下載: https://www.microsoft.com/zh-cn/sql-server/sql-server-downloads 2.在下載目錄中找到下麵這個小的安裝包 SQL2022-SSEI-Dev.exe,運行開始下載SQL server; 二. ...
  • 前言 隨著物聯網(IoT)技術的迅猛發展,MQTT(消息隊列遙測傳輸)協議憑藉其輕量級和高效性,已成為眾多物聯網應用的首選通信標準。 MQTTnet 作為一個高性能的 .NET 開源庫,為 .NET 平臺上的 MQTT 客戶端與伺服器開發提供了強大的支持。 本文將全面介紹 MQTTnet 的核心功能 ...
  • Serilog支持多種接收器用於日誌存儲,增強器用於添加屬性,LogContext管理動態屬性,支持多種輸出格式包括純文本、JSON及ExpressionTemplate。還提供了自定義格式化選項,適用於不同需求。 ...
  • 目錄簡介獲取 HTML 文檔解析 HTML 文檔測試參考文章 簡介 動態內容網站使用 JavaScript 腳本動態檢索和渲染數據,爬取信息時需要模擬瀏覽器行為,否則獲取到的源碼基本是空的。 本文使用的爬取步驟如下: 使用 Selenium 獲取渲染後的 HTML 文檔 使用 HtmlAgility ...
  • 1.前言 什麼是熱更新 游戲或者軟體更新時,無需重新下載客戶端進行安裝,而是在應用程式啟動的情況下,在內部進行資源或者代碼更新 Unity目前常用熱更新解決方案 HybridCLR,Xlua,ILRuntime等 Unity目前常用資源管理解決方案 AssetBundles,Addressable, ...
  • 本文章主要是在C# ASP.NET Core Web API框架實現向手機發送驗證碼簡訊功能。這裡我選擇是一個互億無線簡訊驗證碼平臺,其實像阿裡雲,騰訊雲上面也可以。 首先我們先去 互億無線 https://www.ihuyi.com/api/sms.html 去註冊一個賬號 註冊完成賬號後,它會送 ...
  • 通過以下方式可以高效,並保證數據同步的可靠性 1.API設計 使用RESTful設計,確保API端點明確,並使用適當的HTTP方法(如POST用於創建,PUT用於更新)。 設計清晰的請求和響應模型,以確保客戶端能夠理解預期格式。 2.數據驗證 在伺服器端進行嚴格的數據驗證,確保接收到的數據符合預期格 ...