2015年1月30日星期五

Oracle Study之--基于ASM的TSPITR(基于表空间的完全恢复)

本邮件内容由第三方提供,如果您不想继续收到该邮件,可 点此退订
Oracle Study之--基于ASM的TSPITR(基于表空间的完全恢复)  阅读原文»

Oracle Study之--基于ASM的TSPITR(基于表空间的完全恢复)

系统环境:

操作系统:AIX5.3-08

数据库: Oracle 10gR2

Understanding RMAN TSPITR

In order to use TSPITR effectively, you need to understand what problems it can solve for you, what the major elements used in TSPITR are, what RMAN does during TSPITR, and limitations on when and how it can be applied.

RMAN TSPITR Concepts

Figure 8-1, "Tablespace Point-in-Time Recovery (TSPITR) Architecture"illustrates the context within which TSPITR takes place, and a general outline of the process.

Figure 8-1 Tablespace Point-in-Time Recovery (TSPITR) Architecture

wKiom1TIXrnRCEMWAAGW05m6DzE496.jpg

Description of "Figure 8-1 Tablespace Point-in-Time Recovery (TSPITR) Architecture"

The figure contains the following entities:

  • Thetarget instance, containing the tablespace to be recovered

  • TheRecovery Managerclient

  • Thecontrol fileand (optional)recovery catalog, used for the RMAN repository records of backup activity

  • Archived redo logsandbackup setsfrom the target database, which are the source of the reconstructed tablespace.

  • Theauxiliary instance, an Oracle database instance used in the recovery process to perform the actual work of recovery.

There are four other important terms related to TSPITR, which will be used in the rest of this discussion:

  • Thetarget time, the point in time or SCN that the tablespace will be left at after TSPITR

  • Therecovery set, which consists of the datafiles containing the tablespaces to be recovered;

  • Theauxiliary set, which includes datafiles required for TSPITR of the recovery set which are not themselves part of the recovery set. The auxiliary set typically includes:

    The auxiliary instance has other files associated with it, such as a control file, parameter file, and online logs, but they are not part of the auxiliary set.

    • A copy of the SYSTEM tablespace

    • Datafiles containing rollback or undo segments from the target instance

    • In some cases, a temporary tablespace, used during the export of database objects from the auxiliary instance

  • Theauxiliary destination, an optional location on disk which can be used to store any of the auxiliary set datafiles, control files and online logs of the auxiliary instance during TSPITR. Files stored here can be deleted after TSPITR is complete.

Performing Basic RMAN TSPITR

Having selected your tablespaces to recover and your target time, you are now ready to perform RMAN TSPITR. You have a few different options available to you:

  • Fully automated TSPITR--in which you specify an auxiliary destination and let RMAN manage all aspects of the TSPITR. This is the simplest way to perform TSPITR, and is recommended unless you specifically need more control over the location of recovery set files after TSPITR or auxiliary set files during TSPITR, or control over the channel configurations or some other aspect of your auxiliary instance.

  • Customized TSPITR with an automatic auxiliary instance--in which you base your TSPITR on the behavior of fully automated TSPITR, possibly still using an auxiliary destination, but customize one or more aspects of the behavior, such as the location of auxiliary set or recovery set files, or specifying initialization parameters or channel configurations for the auxiliary instance created and managed by RMAN.

  • TSPITR with your own auxiliary instance--in which you take responsibility for setting up, starting, stopping and cleaning up the auxiliary instance used in TSPITR, and possibly also manage the TSPITR process using some of the methods available in customized TSPITR with an automatic auxiliary instance.

案例分析:

用户在过去的时间点对emp1表做了误操作,需要通过物理备份恢复到过去的数据,本案例采用基于表空间的不完全恢复来实现对表的恢复!

1、案例测试环境

  SQL> show parameter name  NAME                                 TYPE        VALUE  ------------------------------------ ----------- ------------------------------  db_file_name_convert                 string  db_name                              string      zsdb  db_unique_name                       string      zsdb  global_names                         boolean     FALSE  instance_name                        string      zsdb  lock_name_space                      string  log_file_name_convert                string  service_names                        string      zsdb  SQL> select name from v$datafile;  NAME  --------------------------------------------------------------------------------  +DG1/zsdb/datafile/system.257.870003801  +DG1/zsdb/datafile/undotbs1.260.870004111  +DG1/zsdb/datafile/sysaux.258.870003999  +DG1/zsdb/datafile/users.262.870004141  +DG1/zsdb/datafile/zstb.259.870004085  +DG1/zsdb/datafile/testtb.261.870004125  6 rows selected.  SQL> col member for a50  SQL> select group#,member from v$logfile;      GROUP# MEMBER  ---------- --------------------------------------------------           4 +DG1/zsdb/onlinelog/group_4.266.870004663           4 +RCY1/zsdb/onlinelog/group_4.256.870004669           5 +DG1/zsdb/onlinelog/group_5.267.870004689           5 +RCY1/zsdb/onlinelog/group_5.257.870004693  SQL> set linesize 120  SQL> r    1* select file_id,file_name,tablespace_name from dba_data_files     FILE_ID FILE_NAME                                          TABLESPACE_NAME  ---------- -------------------------------------------------- ------------------------------           4 +DG1/zsdb/datafile/users.262.870004141             USERS           3 +DG1/zsdb/datafile/sysaux.258.870003999            SYSAUX           2 +DG1/zsdb/datafile/undotbs1.260.870004111          UNDOTBS1           1 +DG1/zsdb/datafile/system.257.870003801            SYSTEM           5 +DG1/zsdb/datafile/zstb.259.870004085              ZSTB           6 +DG1/zsdb/datafile/testtb.261.870004125            TESTTB  6 rows selected.  

2、建立测试

  SQL> select * from tab;  TNAME                          TABTYPE  CLUSTERID  ------------------------------ ------- ----------  DEPT 
zabbix企业应用之监控域名过期时间与ssl证书过期时间  阅读原文»

zabbix企业应用之监控域名过期时间与ssl证书过期时间

如果各位维护过n多个域名,可能会对备案与续费有所了解,备案是十分麻烦,各种流程,而续费的话,虽然比较简单,但如果你没有提前续费,可能导致域名不可用,甚至被他人给恶意注册,为了解决这样的问他,我今天给各位分享一下,如何使用zabbix监控域名过期时间与ssl证书过期时间,默认的触发器是在域名或ssl证书要过期前60天通知。

下面是监控域名过期时间的效果图

wKiom1TIOHeTYbIlAARFBuMm5aY078.jpg

下面是监控ssl证书过期时间效果图

wKioL1TIOabg9BotAAKsOUQWSlM422.jpg

如何实现:

一、客户端

1、修改zabbix_agentd.conf文件

在zabbix_agentd.conf最后添加以下内容

UserParameter=check_domain_beian[*],python/usr/local/zabbix_server/bin/check_domain_beian.py$1
UserParameter=check_ssl_cert_expire[*],/bin/bashusr/local/zabbix_server/bin/check_ssl_cert_expire.sh$1$2

其中check_domain_beian是监控域名过期时间,check_ssl_cert_expire是监控ssl证书过期时间

2、把下面脚本放入客户端的bin里(我的是放在/usr/local/zabbix_server/bin)

监控域名过期时间的脚本/usr/local/zabbix_server/bin/check_domain_beian.py内容为

#/usr/bin/envpython
#author:denglei
#email:dl528888@gmail.com
importdatetime
check_api='http://whomsy.com/api/%s?output=json'%sys.argv[1]
header={"User-Agent":"Mozilla-Firefox5.0"}
result=urllib2.urlopen(check_api)
check_result=result.read()
printcheck_result
c=re.findall("GODADDY.COM*",check_result)
cc=re.findall("GoDaddy*",check_result)
iflen(c)==0andlen(cc)==0:
c=re.findall("RegistrarRegistrationExpirationDate.*",check_result)
c=re.findall("ExpirationDate.*",check_result)
m=re.search("\d+-\d+-\d+..\d+:\d+:\d+",c[0])
e=re.sub('T','',d)
eliflen(c)==0andlen(cc)!=0:
c=re.findall("Recordexpireson.*",check_result)
m=re.search("\d+-\d+-\d+",c[0])
e=time.strftime("%Y-%m-%d%T",time.strptime(d,'%Y-%m-%d'))
c=re.findall("ExpirationDate.*",check_result)
m=re.search("\d+-\w+-\d+",c[0])
m=re.search("\w+\w+\d+\d+:\d+:\d+\w+\d+",c[0])
e=time.strftime("%Y-%m-%d%T",time.strptime(d,'%a%b%d%H:%M:%S%Z%Y'))
e=time.strftime("%Y-%m-%d%T",time.strptime(d,'%d-%b-%Y'))
iflen(c)==0:
defconver_time(start_time):
start_time=start_time
now_time=time.strftime('%Y-%m-%d%H:%M:%S')
warn_start=datetime.datetime.strptime(start_time,"%Y-%m-%d%H:%M:%S")
warn_finish=datetime.datetime.strptime(now_time,"%Y-%m-%d%H:%M:%S")
#td=warn_finish-warn_start
td=warn_start-warn_finish
warn_continue=(td.microseconds+(td.seconds+td.days*24*3600)*10**6)/10**6
ifwarn_continue>=86400:
day=warn_continue//86400
iflen(e)!=0:
printconver_time(e)

阅读更多内容

没有评论:

发表评论