当前位置:网站首页>Actual ora2pg is migrated from Oracle11g to PG12 four
Actual ora2pg is migrated from Oracle11g to PG12 four
2022-04-21 13:09:00 【Ink Sky Wheel】
ora2pg Version selection
https://github.com/darold/ora2pg/releases
After testing :21.1-23.1 Version uniform import gis The type table reports an error .
ora2pg -p -c xxx.conf -t TABLE -o table.sqlFATAL: _column_info() ORA-00911: invalid character (DBD ERROR: error possibly near <> indicator at char 17 in 'SELECT ST_SRID(c.<>%s) FROM %s c')DBI::db=HASH(0x2ec0bb8)->disconnect invalidates 1 active statement handle (either destroy statement handles or call finish on them before disconnecting) at /usr/local/share/perl5/Ora2Pg.pm line 14893.Aborting export...
So this time we use 21.0 edition .
The steps for version change are very simple :
1. download zip Source code https://github.com/darold/ora2pg/releases2. Upload to oracle The server ,unzip Unzip the corresponding directory v.xx3. Just compile and install cd v.xxperl Makefile.PLmake && make installora2pg -v
install ora2pg May refer to :https://blog.csdn.net/jycjyc/article/details/108466740
1. Prepare the configuration file
db.conf Major changes ORACLE_DSN,ORACLE_USER,ORACLE_PWD,SCHEMA It's OK to wait for parameters .
PG_VERSION 12ORACLE_HOME /oracle/app/oracle/product/11.2.0/dbhome_1ORACLE_DSN dbi:Oracle:host=192.168.226.177;sid=oradb;port=1521ORACLE_USER orauserORACLE_PWD passwordSCHEMA orauser PG_NUMERIC_TYPE 0PG_INTEGER_TYPE 1DEFAULT_NUMERIC floatNLS_LANG AMERICAN_AMERICA.UTF8#ALLOW TPR_* TSM_* #ALLOW tpr_*,tsm_*,twf_*#exclude *_20_* *_TSM_FUNCTION_*#SKIP fkeys pkeys ukeys indexes checks#OUTPUT table.sql
2. Guide table structure and index, etc
ora2pg -p -c db.conf -t TABLE -o table.sql Exclude specific names plus parameters -e 'TABLE[XXX.*,XXX.*]' Specify the name plus parameters -a 'TABLE[XXX.*,XXX.*]' Notice the dot symbol of fuzzy matching .*
3. Import table data
For small libraries , You can output a guide 1 File data.sql
[root@db]# vi data.sh ora2pg -p -c db.conf -t COPY -o data.sql -j 4 [root@db]# chmod +x data.sh [root@db]# nohup ./data.sh > ./data.out &
For large libraries , It is recommended that the data of each table be output separately , More flexible .
oracle The script that splices the exported data : The script conditions can be modified according to the actual needs
select 'ora2pg -p -c db.conf -t COPY -a ''TABLE['|| table_name ||']'' -o '||table_name||'.sql -j 4' from user_tables where table_name not like '%LOG%' and table_name not like '%20%' and table_name not like '%19%' and table_name not like '%21%' and table_name not like '%0%' and table_name not like '%22%' and table_name not like '%_BAK%' and table_name not like '%ColumnMetadata%' and table_name not like '%AQ$%' order by 1 asc;

Output to the above file data.sh Give Execution Authority chmod +x data.sh
And then execute nohup ./data.sh > ./data.out & that will do
4. Guide diagram 、 Stored procedures and other objects
Store the following contents in other.sh in , Then execute it .
# cat other.sh ora2pg -p -c db.conf -t VIEW -o VIEW.sql ora2pg -p -c db.conf -t SEQUENCE -o SEQUENCE.sql ora2pg -p -c db.conf -t TRIGGER -o TRIGGER.sql ora2pg -p -c db.conf -t FUNCTION -o FUNCTION.sql ora2pg -p -c db.conf -t PROCEDURE -o PROCEDURE.sql ora2pg -p -c db.conf -t PACKAGE -o PACKAGE.sql ora2pg -p -c db.conf -t MVIEW -o MVIEW.sql ora2pg -p -c db.conf -t DBLINK -o DBLINK.sql ora2pg -p -c db.conf -t SYNONYM -o SYNONYM.sql ora2pg -p -c db.conf -t TYPE -o TYPE.sql # chmod +x other.sh # nohup ./other.sh > ./other.out# tail -f other.out
5. Import operation
export PGPASSWORD=xxx Save the trouble of inputting the password every time
5.1 guide type type , First import :
psql --host=192.168.208.40 --port=5432 --username=pguser --echo-errors pgdb -f TYPE.sql -1
pg Add... At the end of import -1 Parameters , In this way, as long as an error is reported, it will immediately fail, roll back and throw an error .
5.2 Guide table structure
psql --host=192.168.208.40 --port=5432 --username=pguser --echo-errors pgdb -f table.sql -1
5.3 Lead sequence
psql --host=192.168.208.40 --port=5432 --username=pguser --echo-errors pgdb -f SEQUENCE.sql
5.4 Leading data ( Similar to the 4 Step , Consider writing sh In file , One batch processing , Re examination out journal , Just confirm whether there is any problem to be solved )
psql --host=192.168.208.40 --port=5432 --username=pguser--echo-errors pgdb -f data.sql -1
5.4 Import other objects , ditto
版权声明
本文为[Ink Sky Wheel]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204211303333492.html
边栏推荐
- Creating host elements of Revit secondary development (doors and windows, etc.) (issue 14)
- Revit secondary development - multi pipe linear annotation (phase 18)
- 【数字信号处理】相关函数 ( 能量信号 | 能量信号的互相关函数 | 能量信号的自相关函数 )
- S TYLE N E RF: A S TYLE - BASED 3D-A WARE G ENERA - TOR FOR H IGH - RESOLUTION I MAGE S YNTHESIS
- Revit secondary development - creating grids (phase 9)
- Revit secondary development - creating floors (phase 12)
- 一个人怎么拍自媒体视频,三农领域的运营技巧
- 2022年G3锅炉水处理上岗证题目及答案
- 从Revit中选取元素(第五期)
- MySQL使用安装pip和binlog2sql
猜你喜欢

Village vlog harvest 8000w + play, another flow ceiling?

网易云---手机验证码登录

With monthly sales exceeding 10 million, how can "Jiaoxia" become a popular manufacturing machine in the new sunscreen era?

S TYLE N E RF: A S TYLE - BASED 3D-A WARE G ENERA - TOR FOR H IGH - RESOLUTION I MAGE S YNTHESIS

Go语言 文件操作

2021-08-10

Eight common probability distribution formulas and visualization

Go语言 文件操作

Master slave replication -- 03 -- synchronization data consistency

redis-常见问题
随机推荐
How to open a securities account for goucai? Is it safer to open an account in a securities firm?
这是一期Revit二次开发小案例(自动布置支吊架)
C language nesting exercise
Revit secondary development - creating and switching tags (issue 16)
SM state secret learning
Algorithem_ Populating Next Right Pointers in Each Node
Calculate the day of the year and implement it in C language
CPT 102_LEC 10
通信滑动窗口
Revit secondary development - creating walls (1) (phase 10)
【数字信号处理】线性常系数差分方程 ( 使用 matlab 求解 “ 线性常系数差分方程 “ 示例 | A 向量分析 | B 向量分析 | 输入序列分析 | matlab 代码 )
Revit secondary development - creating grids (phase 9)
20210818 diary
The 2022 language and intelligent technology competition was upgraded to launch four cutting-edge tasks of NLP
20210812
实战ora2pg迁移oracle11g到pg12.4
【uvm】 多模块env结构
Revit二次开发——多管道线性标注(第十八期)
L2-013 red alarm (25 points)
[digital signal processing] linear constant coefficient difference equation (determine whether the system is a "linear time invariant system" according to "linear constant coefficient difference equat