ORACLE 10G stored outline迁移到11G

本文涉及的产品
云原生数据仓库AnalyticDB MySQL版,基础版 8ACU 100GB 1个月
简介:

   测试环境是:DB: 11.2.0.3 ,10.2.0.4 OS:RHEL 4.8

   把10G中的stored outline数据迁移到11G中

1,导出测试表中的数据

 
  1. [oracle10g@rhel4 sql]$ expdp  scott/oracle tables=test1  directory=test dumpfile=test1.dmp; 
  2.  
  3. Export: Release 10.2.0.4.0 - 64bit Production on Saturday, 06 April, 2013 21:14:00 
  4.  
  5. Copyright (c) 2003, 2007, Oracle.  All rights reserved. 
  6.  
  7. Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bit Production 
  8. With the Partitioning, OLAP, Data Mining and Real Application Testing options 
  9. Starting "SCOTT"."SYS_EXPORT_TABLE_01":  scott/******** tables=test1 directory=test dumpfile=test1.dmp  
  10. Estimate in progress using BLOCKS method... 
  11. Processing object type TABLE_EXPORT/TABLE/TABLE_DATA 
  12. Total estimation using BLOCKS method: 2.875 GB 
  13. Processing object type TABLE_EXPORT/TABLE/TABLE 
  14. Processing object type TABLE_EXPORT/TABLE/INDEX/INDEX 
  15. Processing object type TABLE_EXPORT/TABLE/INDEX/STATISTICS/INDEX_STATISTICS 
  16. Processing object type TABLE_EXPORT/TABLE/STATISTICS/TABLE_STATISTICS 
  17. . . exported "SCOTT"."TEST1"                             4.636 MB   50091 rows 
  18. Master table "SCOTT"."SYS_EXPORT_TABLE_01" successfully loaded/unloaded 
  19. ****************************************************************************** 
  20. Dump file set for SCOTT.SYS_EXPORT_TABLE_01 is: 
  21.   /tmp/test1.dmp 
  22. Job "SCOTT"."SYS_EXPORT_TABLE_01" successfully completed at 21:14:18 

2,导出stored outline,name为new_outline_1

 
  1. [oracle10g@rhel4 tmp]$ expdp outln/oracle directory=test TABLES=(OL\$,OL\$HINTS,OL\$NODES) dumpfile=outln.dmp  parfile=query.par 
  2.  
  3. Export: Release 10.2.0.4.0 - 64bit Production on Saturday, 06 April, 2013 21:46:18 
  4.  
  5. Copyright (c) 2003, 2007, Oracle.  All rights reserved. 
  6.  
  7. Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bit Production 
  8. With the Partitioning, OLAP, Data Mining and Real Application Testing options 
  9. Starting "OUTLN"."SYS_EXPORT_TABLE_02":  outln/******** directory=test TABLES=(OL$,OL$HINTS,OL$NODES) dumpfile=outln.dmp parfile=query.par  
  10. Estimate in progress using BLOCKS method... 
  11. Processing object type TABLE_EXPORT/TABLE/TABLE_DATA 
  12. Total estimation using BLOCKS method: 640 KB 
  13. Processing object type TABLE_EXPORT/TABLE/TABLE 
  14. Processing object type TABLE_EXPORT/TABLE/GRANT/OWNER_GRANT/OBJECT_GRANT 
  15. Processing object type TABLE_EXPORT/TABLE/INDEX/INDEX 
  16. Processing object type TABLE_EXPORT/TABLE/INDEX/STATISTICS/INDEX_STATISTICS 
  17. Processing object type TABLE_EXPORT/TABLE/STATISTICS/TABLE_STATISTICS 
  18. Processing object type TABLE_EXPORT/TABLE/POST_TABLE_ACTION 
  19. . . exported "OUTLN"."OL$HINTS"                          11.59 KB       5 rows 
  20. . . exported "OUTLN"."OL$"                               9.070 KB       1 rows 
  21. . . exported "OUTLN"."OL$NODES"                          7.078 KB       1 rows 
  22. Master table "OUTLN"."SYS_EXPORT_TABLE_02" successfully loaded/unloaded 
  23. ****************************************************************************** 
  24. Dump file set for OUTLN.SYS_EXPORT_TABLE_02 is: 
  25.   /tmp/outln.dmp 
  26. Job "OUTLN"."SYS_EXPORT_TABLE_02" successfully completed at 21:46:23 
  27.  
  28. [oracle10g@rhel4 tmp]$ cat query.par 
  29. query=ol$:"where ol_name=upper('new_outline_1')",OL$HINTS:"where ol_name=upper('new_outline_1')",OL$NODES:"where ol_name=upper('new_outline_1')" 
  30. [oracle10g@rhel4 tmp]$  

3,把测试数据导入到11G SCOTT用户下面

 
  1. [oracle11g@rhel4 sql]$ impdp scott/oracle directory=dump dumpfile=test1.dmp TABLE_EXISTS_ACTION=append logfile=imdp.log 
  2.  
  3. Import: Release 11.2.0.3.0 - Production on Sat Apr 6 21:51:08 2013 
  4.  
  5. Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved. 
  6.  
  7. Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production 
  8. With the Partitioning, OLAP, Data Mining and Real Application Testing options 
  9. Master table "SCOTT"."SYS_IMPORT_FULL_01" successfully loaded/unloaded 
  10. Starting "SCOTT"."SYS_IMPORT_FULL_01":  scott/******** directory=dump dumpfile=test1.dmp TABLE_EXISTS_ACTION=append logfile=imdp.log  
  11. Processing object type TABLE_EXPORT/TABLE/TABLE 
  12. Processing object type TABLE_EXPORT/TABLE/TABLE_DATA 
  13. . . imported "SCOTT"."TEST1"                             4.636 MB   50091 rows 
  14. Processing object type TABLE_EXPORT/TABLE/INDEX/INDEX 
  15. Processing object type TABLE_EXPORT/TABLE/INDEX/STATISTICS/INDEX_STATISTICS 
  16. Processing object type TABLE_EXPORT/TABLE/STATISTICS/TABLE_STATISTICS 
  17. Job "SCOTT"."SYS_IMPORT_FULL_01" successfully completed at 21:51:12 

4,把stored outline数据导入到11G OUTLN用户中

 
  1. [oracle11g@rhel4 sql]$ impdp outln/oracle directory=dump dumpfile=outln.dmp TABLE_EXISTS_ACTION=append 
  2.  
  3. Import: Release 11.2.0.3.0 - Production on Sat Apr 6 21:51:52 2013 
  4.  
  5. Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved. 
  6.  
  7. Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production 
  8. With the Partitioning, OLAP, Data Mining and Real Application Testing options 
  9. Master table "OUTLN"."SYS_IMPORT_FULL_01" successfully loaded/unloaded 
  10. Starting "OUTLN"."SYS_IMPORT_FULL_01":  outln/******** directory=dump dumpfile=outln.dmp TABLE_EXISTS_ACTION=append  
  11. Processing object type TABLE_EXPORT/TABLE/TABLE 
  12. Table "OUTLN"."OL$" exists. Data will be appended to existing table but all dependent metadata will be skipped due to table_exists_action of append 
  13. Table "OUTLN"."OL$NODES" exists. Data will be appended to existing table but all dependent metadata will be skipped due to table_exists_action of append 
  14. Table "OUTLN"."OL$HINTS" exists. Data will be appended to existing table but all dependent metadata will be skipped due to table_exists_action of append 
  15. Processing object type TABLE_EXPORT/TABLE/TABLE_DATA 
  16. . . imported "OUTLN"."OL$HINTS"                          11.59 KB       5 rows 
  17. . . imported "OUTLN"."OL$"                               9.070 KB       1 rows 
  18. . . imported "OUTLN"."OL$NODES"                          7.078 KB       1 rows 
  19. Processing object type TABLE_EXPORT/TABLE/GRANT/OWNER_GRANT/OBJECT_GRANT 
  20. Processing object type TABLE_EXPORT/TABLE/INDEX/INDEX 
  21. Processing object type TABLE_EXPORT/TABLE/INDEX/STATISTICS/INDEX_STATISTICS 
  22. Processing object type TABLE_EXPORT/TABLE/STATISTICS/TABLE_STATISTICS 
  23. Processing object type TABLE_EXPORT/TABLE/POST_TABLE_ACTION 
  24. Job "OUTLN"."SYS_IMPORT_FULL_01" successfully completed at 21:52:00 
  25.  
  26.  
  27. 查看是否已经生成new_outline_1 
  28. SQL> @sql_outline 
  29. Wrote file sqlplusset 
  30.  
  31. CATEGORY 
  32. --------------- 
  33. DEFAULT 
  34. Enter value for owner: scott 
  35. Enter value for category: default 
  36. Enter value for used:  
  37.  
  38.                                                                      CREATE 
  39. NAME                          OWNER           CATEGORY        USED   TIME     COMPATIBLE   ENABLED  FORMAT SQL_TEXT 
  40. ----------------------------- --------------- --------------- ------ -------- ------------ -------- ------ ---------------------------------------------------------------------- 
  41. NEW_OUTLINE_1                 SCOTT           DEFAULT         USED   13 04-06 COMPATIBLE   ENABLED  NORMAL select /*+ full(t)*/ count(*) from test1 t where object_id=1 

5,测试是否生产

 
  1. 修改参数 
  2. SQL> ALTER SYSTEM SET USE_STORED_OUTLINES = TRUE
  3.  
  4. System altered. 
  5.  
  6. SQL> conn scott/oracle 
  7. Connected. 
  8. SQL> set autotrace traceonly; 
  9. 测试是否生效 
  10. SQL> select /*+ full(t)*/ count(*) from test1 t where object_id=1
  11.  
  12.  
  13. Execution Plan 
  14. ---------------------------------------------------------- 
  15. Plan hash value: 4017242292 
  16.  
  17. ------------------------------------------------------------------------------ 
  18. | Id  | Operation         | Name     | Rows  | Bytes | Cost (%CPU)| Time     | 
  19. ------------------------------------------------------------------------------ 
  20. |   0 | SELECT STATEMENT  |          |     1 |     3 |     1   (0)| 00:00:01 | 
  21. |   1 |  SORT AGGREGATE   |          |     1 |     3 |            |          | 
  22. |*  2 |   INDEX RANGE SCAN| TEST1_ID |     1 |     3 |     1   (0)| 00:00:01 | 
  23. ------------------------------------------------------------------------------ 
  24.  
  25. Predicate Information (identified by operation id): 
  26. --------------------------------------------------- 
  27.  
  28.    2 - access("OBJECT_ID"=1) 
  29.  
  30. Note 
  31. ----- 
  32.    - outline "NEW_OUTLINE_1" used for this statement 
  33.  
  34.  
  35. Statistics 
  36. ---------------------------------------------------------- 
  37.         222  recursive calls 
  38.         130  db block gets 
  39.         199  consistent gets 
  40.           2  physical reads 
  41.         116  redo size 
  42.         526  bytes sent via SQL*Net to client 
  43.         520  bytes received via SQL*Net from client 
  44.           2  SQL*Net roundtrips to/from client 
  45.          27  sorts (memory) 
  46.           0  sorts (disk) 
  47.           1  rows processed 
  48.  
  49. 已经成功 

 


     本文转自7343696 51CTO博客,原文链接:http://blog.51cto.com/luoping/1172789,如需转载请自行联系原作者



相关实践学习
阿里云云原生数据仓库AnalyticDB MySQL版 使用教程
云原生数据仓库AnalyticDB MySQL版是一种支持高并发低延时查询的新一代云原生数据仓库,高度兼容MySQL协议以及SQL:92、SQL:99、SQL:2003标准,可以对海量数据进行即时的多维分析透视和业务探索,快速构建企业云上数据仓库。 了解产品 https://www.aliyun.com/product/ApsaraDB/ads
相关文章
|
Oracle 关系型数据库 数据库
使用docker安装配置oracle 11g
使用docker安装配置oracle 11g
|
6月前
|
Oracle 关系型数据库
【YashanDB知识库】YMP从oracle到yashan迁移评估报OCI相关错误
本文来自YashanDB官网,主要解决在使用YMP(yashan-migrate-platform)进行迁移评估时出现的OCI版本检查错误问题。错误原因为操作系统重装后,OCI所需依赖缺失(如`libnsl.so.1`、`libnnz19.so`等)。文章提供了排查步骤和解决方法:一是检查并配置环境变量`LD_LIBRARY_PATH`,二是若依赖仍缺失,则需手动下载并安装对应依赖文件。适用于使用YMP迁移平台的用户遇到OCI相关问题时参考。
|
6月前
|
Oracle 关系型数据库 网络安全
崖山异构数据库迁移利器YMP初体验-Oracle迁移YashanDB
文章是作者小草对崖山异构数据库迁移利器 YMP 的初体验分享,包括背景、YMP 简介、体验环境说明、YMP 部署(含安装前准备、安装、卸载、启动与停止)、数据迁移及遇到的问题与解决过程。重点介绍了 YMP 功能、部署的诸多细节和数据迁移流程,还提到了安装和迁移中遇到的问题及解决办法。
|
6月前
|
SQL Oracle 关系型数据库
Oracle向YashanDB迁移的丝滑体验
这篇文章主要介绍了从 Oracle 向 YashanDB 迁移的过程,包括 YashanDB 迁移平台 YMP 的介绍、下载安装准备、安装步骤、运行状态及访问方式,迁移中的添加数据源、创建任务、迁移配置、离线迁移、一致性校验等环节,还分享了迁移后的体验,认为 YMP 不错但希望增加在线迁移等功能。
|
6月前
|
SQL Oracle 关系型数据库
【YashanDB知识库】YMP迁移oracle不兼容给用户授权高级包
【YashanDB知识库】YMP迁移oracle不兼容给用户授权高级包
|
6月前
|
SQL Oracle 关系型数据库
基于YMP工具实现Oracle迁移YashanDB
这篇文章主要介绍了基于 YMP 工具实现 Oracle 迁移 YashanDB 的相关内容,包括 YMP 工具的简介、架构、规格,迁移前的环境准备和工具部署,迁移过程中的创建任务、评估、配置、离线迁移、校验等步骤,以及迁移体验,指出其部署简单、数据类型兼容但存在部分功能不支持等情况。
|
6月前
|
Oracle 关系型数据库 MySQL
使用崖山YMP 迁移 Oracle/MySQL 至YashanDB 23.2 验证测试
这篇文章是作者尚雷关于使用崖山YMP迁移Oracle/MySQL至YashanDB 23.2的验证测试分享。介绍了YMP的产品信息,包括架构、版本支持等,还详细阐述了外置库部署、YMP部署、访问YMP、数据源管理、任务管理(创建任务、迁移配置、离线迁移、校验初始化、一致性校验)及MySQL迁移的全过程。
|
SQL 运维 Oracle
【迁移秘籍揭晓】ADB如何助你一臂之力,轻松玩转Oracle至ADB的数据大转移?
【8月更文挑战第27天】ADB(Autonomous Database)是由甲骨文公司推出的自动化的数据库服务,它极大简化了数据库的运维工作。在从传统Oracle数据库升级至ADB的过程中,数据迁移至关重要。
203 0
|
Oracle 关系型数据库 数据库
Oracle 11G数据库安装步骤及截图操作2
Oracle 11G数据库安装步骤及截图操作
133 0
|
Oracle 安全 关系型数据库
Oracle 11G数据库安装步骤及截图操作1
Oracle 11G数据库安装步骤及截图操作
187 0