眾所周知,數(shù)據(jù)庫(kù)升級(jí)、轉(zhuǎn)換、遷移是數(shù)據(jù)庫(kù)運(yùn)維必備的日常技能,本文詳細(xì)介紹一則將DB2數(shù)據(jù)庫(kù)轉(zhuǎn)換成Oracle數(shù)據(jù)庫(kù)的案例,希望對(duì)大家有幫助。
1.前言
記錄一則使用sql developer工具,將DB2數(shù)據(jù)庫(kù)遷移到ORACLE數(shù)據(jù)庫(kù)的案例。
2.環(huán)境準(zhǔn)備
- 安裝ORACLE數(shù)據(jù)庫(kù)并創(chuàng)建實(shí)例
- 安裝DB2軟件
- 安裝SQL DEVELOPER 軟件
3.備份生產(chǎn)環(huán)境DB2數(shù)據(jù)庫(kù)
#! /bin/bash
source /home/db2/.bash_profile
TODAY=`date +%Y%m%d%H%M%S`
db2 backup db db2 online to /home/db2 compress include logs
4.將備份傳到新的DB2環(huán)境(在新環(huán)境進(jìn)行數(shù)據(jù)轉(zhuǎn)換最大可能地保護(hù)生產(chǎn)數(shù)據(jù))
5.在新環(huán)境恢復(fù)DB2數(shù)據(jù)庫(kù)
db2 'RESTORE DB db2 FROM "/home/db2/" TAKEN AT 20200729053002 LOGTARGET /home/db2arclog'
db2 'ROLLFORWARD DB db2 to end of backup and stop OVERFLOW LOG PATH (/home/db2/arclog)'
db2 update dbm cfg using SYSMAINT_GROUP db2
db2 list Applications
db2stop force
db2start
db2 connect to db2 user db2 using db2
db2 "grant dbadm on database to user db2"
db2 "grant dbadm on database to user db2"
db2look -d db2 -l -e -x -o db2.sql
6.ORACLE環(huán)境創(chuàng)建用戶(hù)
create user mig identified by "mig"
default tablespace DATA
temporary tablespace temp
quota unlimited on DATA;
GRANT RESOURCE TO MIG WITH ADMIN OPTION;
GRANT CONNECT, RESOURCE, CREATE VIEW, CREATE MATERIALIZED VIEW,
CREATE PUBLIC SYNONYM TO MIG WITH ADMIN OPTION;
7.使用SQL developer進(jìn)行數(shù)據(jù)轉(zhuǎn)換
7.1創(chuàng)建一個(gè)連接到目標(biāo)ORACLE數(shù)據(jù)庫(kù)
7.2創(chuàng)建一個(gè)連接到源端DB2數(shù)據(jù)庫(kù)
7.3ORALCE數(shù)據(jù)庫(kù)創(chuàng)建一個(gè)遷移存儲(chǔ)庫(kù)
7.4 DB2數(shù)據(jù)庫(kù)關(guān)聯(lián)到需要遷移的ORACLE
7.5正式進(jìn)行遷移
7.6連接到源端數(shù)據(jù)庫(kù)
7.7創(chuàng)建遷移名稱(chēng)
7.8連接源端
7.9選擇需要遷移的數(shù)據(jù)庫(kù)
...
? 接下來(lái)內(nèi)容請(qǐng)?jiān)L問(wèn)原文(https://www.modb.pro/db/28448?YYF)進(jìn)行查看~
更多數(shù)據(jù)庫(kù)相關(guān)內(nèi)容,可訪(fǎng)問(wèn)墨天輪(https://www.modb.pro/?YYF)進(jìn)行瀏覽。