»ùÓÚ OCI ʵÏÖµÄ oracle ×î¸ßЧdump³ÌÐò
»ùÓÚOCI ʵÏÖµÄ ×î¸ßЧdump³ÌÐò£¬ ±ÈOTL ÒÔ¼°ÆäËûµÄ½Ó¿Ú¶¼¿ìºÜ¶à
ÄÜÖ´ÐÐÈκÎsql , ×Ô¶¯Ê¶±ð×Ö¶ÎÃûºÍ×Ö¶ÎÀàÐÍ£¬½øÐÐÊä³öÊä³ö
/*
* oracle_dump.cpp
*
* Created on: 2010-2-1
* Author: clm971910@gmail.com
*
* ѹËõ
* 4216351 dump done
* ÍêÕû 106 Ãë
* д·Ö¸ô·û 8Ãë
* ѹËõд´ÅÅÌ 34Ãë
* ¶ÁÊý¾Ý 9Ãë
* Êý¾Ý¿â²éѯ 54Ãë
*/
#include <iostream>
#include <string>
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <errno.h>
#include <getopt.h>
#include <oci.h>
#include <oratypes.h>
#include <ocidfn.h>
#ifdef __STDC__
#include <ociapr.h>
#else
#include <ocikpr.h>
#endif
#include <ocidem.h>
#include "tbZip.h"
using namespace std;
/* =================== macro =====================*/
#define MAX_SELECT_COL_SIZE 1000 /* sqlÖÐ×î´óµÄÁÐÊý */
#define MAX_COLNAME_LEN 54 /* ÁÐÃû×î´ó³¤¶È */
#define MAX_SQL_LINE_SIZE 1024 /* sqlµÄ×î´ó³¤¶È */
#define MBYTE 1024 * 1024 /* 1M µÄ×Ö½ÚÊý */
#define DEFAULT_FETCH_SIZE 1000 /* ÿ´ÎÈ¡µÄ¼Ç¼Êý */
#define MAX_COLDATA_LEN 16 * 1024 /* ÁÐÊý¾ÝµÄ×î´ó³¤¶È */
/*=====================define all struct=======================*/
/* OCI »·¾³ */
typedef struct OCI_ENV
{
OCIEnv *oci_env; /* »·¾³¾ä±ú */
OCISvcCtx *oci_svc; /* ·þÎñÆ÷»·¾³¾ä±ú */
OCIServer *oci_srv; /* ·þÎñÆ÷¾ä±ú */
OCIError *oci_err; /* ´íÎó¾ä±ú */
OCIStmt *oci_stmt; /* Óï¾ä¾ä±ú */
OCISession *oci_session; /* »á»°¾ä±ú */
} OCI_ENV;
/* ÁÐÔªÐÅÏ¢ */
typedef struct COL_META
{
ub2 colType; /* ×Ö¶ÎÀ
Ïà¹ØÎĵµ£º
with
lockinfo as (
select distinct decode(sql_hash_value, 0, prev_hash_value, sql_hash_value) sql_hash_value, decode (sql_hash_value, 0, prev_sql_addr, sql_address) sql_address, s.sid, l.id1 object_id, l.block
from v$lock l, v$session s
&n ......
ÐÞ ¸Ä SID
°¸Àý: ¾ÉÊý¾Ý¿â(OLDDB)
Îļþ´æ·Å(data files,redo files,control files,temp files, undo files)Ŀ¼ÊÇ
(/u01/OLDDB)
dumpÎļþĿ¼ÊÇ(/u01/dump)
ÐÂÊý¾Ý¿â(NEWDB)
......
oracle ÔöÁ¿±¸·Ý½Å±¾
¡¡¡¡OS :RHEL AS 4 oracle 10g
¡¡¡¡0±¸·Ý½Å±¾
¡¡¡¡#!/bin/bash
¡¡¡¡# incremental level 0 backup script
¡¡¡¡source /home/oracle/.bash_profile
¡¡¡¡current_day=`date +%Y%m%d`
¡¡¡¡mkdir /home/oracle/RMANBACKUP/$current_day
¡¡¡¡rman target / <<EOF
¡¡¡¡run
¡¡¡¡{
¡¡¡¡CONFIG ......
¶ÔÓÚUNDO
±í¿Õ¼ä´óСµÄ¶¨ÒåÐèÒª¿¼ÂÇUNDO_RETNETION
²ÎÊý¡¢²úÉúµÄUNDO BLOCKS/
Ãë¡¢UNDO BLOCK
µÄ´óС¡£undo_retention
£º¶ÔÓÚUNDO
±í¿Õ¼äµÄÊý¾ÝÎļþÊôÐÔΪautoextensible,
Ôòundo_retenion
²ÎÊý±ØÐëÉèÖã¬UNDO
ÐÅÏ¢½«ÖÁÉÙ±£ÁôÖÁundo_retention
²ÎÊýÉ趨µÄÖµÄÚ£¬µ«UNDO
±í¿Õ¼ä½«»á×Ô¶¯À©Õ¹¡£¶ÔÓڹ̶¨UNDO
±í¿Õ¼ä ......