oracle 11g 传输表空间(数据迁移)
环境情况 Source 端: 操作系统: OracleLinux 6.2 64位 endianness式: little 数据库版本:11.2.0.3 Target 端: 操作系统:OracleLinux 6.2 64位 endianness 式: little 数据库版本:11.2.0.3 1、查看操作系统endianness式 col platform_name for a40SELECT
环境情况Source 端:
操作系统: OracleLinux 6.2 64位endianness格式: little数据库版本:11.2.0.3
Target 端:
操作系统:OracleLinux 6.2 64位endianness 格式: little数据库版本:11.2.0.3
1、查看操作系统endianness格式
col platform_name for a40 SELECT * FROM V$TRANSPORTABLE_PLATFORM ORDER BY PLATFORM_ID; PLATFORM_ID PLATFORM_NAME ENDIAN_FORMAT ----------- ---------------------------------------- -------------- 1 Solaris[tm] OE (32-bit) Big 2 Solaris[tm] OE (64-bit) Big 3 HP-UX (64-bit) Big 4 HP-UX IA (64-bit) Big 5 HP Tru64 UNIX Little 6 AIX-Based Systems (64-bit) Big 7 Microsoft Windows IA (32-bit) Little 8 Microsoft Windows IA (64-bit) Little 9 IBM zSeries Based Linux Big 10 Linux IA (32-bit) Little 11 Linux IA (64-bit) Little 12 Microsoft Windows x86 64-bit Little 13 Linux x86 64-bit Little 15 HP Open VMS Little 16 Apple Mac OS Big 17 Solaris Operating System (x86) Little 18 IBM Power Based Linux Big 19 HP IA Open VMS Little 20 Solaris Operating System (x86-64) Little 21 Apple Mac OS (x86-64) Little 20 rows selected. --分别查看 source 端 和target端操作系统endianness格式 --source SELECT d.PLATFORM_NAME, ENDIAN_FORMAT FROM V$TRANSPORTABLE_PLATFORM tp, V$DATABASE d WHERE tp.PLATFORM_NAME =d.PLATFORM_NAME; PLATFORM_NAME ENDIAN_FORMAT ---------------------------------------- -------------- Linux x86 64-bit Little --target SELECT d.PLATFORM_NAME, ENDIAN_FORMAT FROM V$TRANSPORTABLE_PLATFORM tp, V$DATABASE d WHERE tp.PLATFORM_NAME =d.PLATFORM_NAME; PLATFORM_NAME ENDIAN_FORMAT ---------------------------------------- -------------- Linux x86 64-bit Little
select tablespace_name, status from dba_tablespaces; TABLESPACE_NAME STATUS ------------------------------ --------- SYSTEM ONLINE UNDOTBS1 ONLINE SYSAUX ONLINE TEMPTS1 ONLINE USERS ONLINE OUTLN ONLINE 6 rows selected. select file_name from dba_data_files; FILE_NAME ------------------------------------------------ /u01/app/oracle/oradata/normal/system01.dbf /u01/app/oracle/oradata/normal/undotbs01.dbf /u01/app/oracle/oradata/normal/sysaux01.dbf /u01/app/oracle/oradata/normal/users01.dbf /u01/app/oracle/oradata/normal/undotbs02.dbf /u01/app/oracle/oradata/normal/system02.dbf /u01/app/oracle/oradata/normal/outln01.dbf 7 rows selected. --创建表空间创建表空间 tset create tablespace tset datafile '/u01/app/oracle/oradata/normal/test01.dbf' size 50M; Tablespace created. --创建用户source_test,并指定表空间 --在source端 create user source_test identified by oracle default tablespace tset temporary tablespace TEMPTS1; User created. grant connect,resource to source_test; Grant succeeded. --在target端(暂时只先创建用户) create user target_test identified by oracle temporary tablespace TEMPTS1; User created. grant connect,resource to target_test; Grant succeeded. --创建测试表 SQL> conn source_test/oracle Connected. SQL> create table t1(id number, name varchar2(30)); Table created. SQL> insert into t1 values(1, 'AAAAA'); 1 row created. SQL> insert into t1 values(2, 'BBBBB'); 1 row created. SQL> commit; Commit complete. select * from t1; ID NAME ---------- ------------------------------ 1 AAAAA 2 BBBBB
[oracle@normal ~]$ mkdir -p /u01/backup [oracle@normal ~]$ ls -l /u01 total 24 drwxr-xr-x 3 oracle oinstall 4096 Jul 28 12:31 app drwxr-xr-x 2 oracle oinstall 4096 Sep 14 16:21 backup SQL> show user USER is "SYS" SQL> create directory backup as '/u01/backup'; Directory created. SQL> col owner format a5 SQL> col directory_name format a25 SQL> col DIRECTORY_PATH format a50 SQL> select * from dba_directories; OWNER DIRECTORY_NAME DIRECTORY_PATH ----- ------------------------- -------------------------------------------------- SYS BACKUP /u01/backup SYS OUTLN_DIR /home/oracle SYS DATA_PUMP_DIR /u01/app/oracle/product/11.2.0/db_1/rdbms/log/ SYS ORACLE_OCM_CONFIG_DIR /u01/app/oracle/product/11.2.0/db_1/ccr/state SQL> GRANT read, write ON DIRECTORY backup TO source_test; Grant succeeded. --在target端 [oracle@test ~]$ mkdir -p /u01/backup [oracle@test ~]$ ls -l /u01 total 24 drwxr-xr-x 3 oracle oinstall 4096 Aug 28 09:09 app drwxr-xr-x 2 oracle oinstall 4096 Sep 14 16:40 backup SQL> show user USER is "SYS" SQL> create directory backup as '/u01/backup'; Directory created. SQL> col owner format a5 SQL> col directory_name format a25 SQL> col DIRECTORY_PATH format a50 SQL> select * from dba_directories; OWNER DIRECTORY_NAME DIRECTORY_PATH ----- ------------------------- -------------------------------------------------- SYS BACKUP /u01/backup SYS OUTLN_DIR /home/oracle SYS DATA_PUMP_DIR /u01/app/oracle/product/11.2.0/db_1/rdbms/log/ SYS ORACLE_OCM_CONFIG_DIR /u01/app/oracle/product/11.2.0/db_1/ccr/state SQL> GRANT read, write ON DIRECTORY backup TO target_test; Grant succeeded.
SQL> execute dbms_tts.transport_set_check('TSET', TRUE); PL/SQL procedure successfully completed. --查看自包含验证结果: SQL> select * from transport_set_violations; no rows selected --没有记录说明没有错
SQL> alter tablespace TSET read only; Tablespace altered. select tablespace_name, status from dba_tablespaces; TABLESPACE_NAME STATUS ------------------------------ --------- SYSTEM ONLINE UNDOTBS1 ONLINE SYSAUX ONLINE TEMPTS1 ONLINE USERS ONLINE OUTLN ONLINE TSET READ ONLY 7 rows selected.
Transportable Tablespace Set有两部分:
1.expdp 导出的表空间的metadata
2.还有就是表空间对应的数据文件
--expdp 导出的表空间的metadata [oracle@normal normal]$ pwd /u01/app/oracle/oradata/normal [oracle@normal normal]$ ll total 2294664 -rw-r----- 1 oracle oinstall 9781248 Sep 14 16:46 control01.ctl drwx------ 2 oracle oinstall 16384 Aug 22 12:44 lost+found -rw-r----- 1 oracle oinstall 20979712 Sep 14 15:52 outln01.dbf -rw-r----- 1 oracle oinstall 52429312 Sep 14 16:45 redo01a.log -rw-r----- 1 oracle oinstall 52429312 Sep 14 16:45 redo01b.log -rw-r----- 1 oracle oinstall 52429312 Sep 14 15:52 redo02a.log -rw-r----- 1 oracle oinstall 52429312 Sep 14 15:52 redo02b.log -rw-r----- 1 oracle oinstall 52429312 Sep 14 15:52 redo03a.log -rw-r----- 1 oracle oinstall 52429312 Sep 14 15:52 redo03b.log -rw-r--r-- 1 oracle oinstall 22633 Aug 22 17:00 su.lst -rw-r----- 1 oracle oinstall 340795392 Sep 14 16:40 sysaux01.dbf -rw-r----- 1 oracle oinstall 340795392 Sep 14 16:43 system01.dbf -rw-r----- 1 oracle oinstall 314580992 Sep 14 16:43 system02.dbf -rw-r----- 1 oracle oinstall 20979712 Sep 14 15:53 temp01.dbf -rw-r----- 1 oracle oinstall 52436992 Sep 14 15:53 temp02.dbf -rw-r----- 1 oracle oinstall 52436992 Sep 14 16:31 test01.dbf -rw-r----- 1 oracle oinstall 209723392 Sep 14 16:43 undotbs01.dbf -rw-r----- 1 oracle oinstall 209723392 Sep 14 16:40 undotbs02.dbf -rw-r----- 1 oracle oinstall 524296192 Sep 14 15:52 users01.dbf [oracle@normal normal]$ expdp dumpfile=test01.dmp directory=backup transport_tablespaces=TSET transport_full_check=y logfile=TSET.log Export: Release 11.2.0.3.0 - Production on Sun Sep 14 16:54:30 2014 Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved. Username: / as sysdba Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production With the Partitioning, OLAP, Data Mining and Real Application Testing options Starting "SYS"."SYS_EXPORT_TRANSPORTABLE_01": /********/ AS SYSDBA dumpfile=test01.dmp directory=backup transport_tablespaces=TSET transport_full_check=y logfile=TSET.log Processing object type TRANSPORTABLE_EXPORT/PLUGTS_BLK Processing object type TRANSPORTABLE_EXPORT/TABLE Processing object type TRANSPORTABLE_EXPORT/POST_INSTANCE/PLUGTS_BLK Master table "SYS"."SYS_EXPORT_TRANSPORTABLE_01" successfully loaded/unloaded ****************************************************************************** Dump file set for SYS.SYS_EXPORT_TRANSPORTABLE_01 is: /u01/backup/test01.dmp ****************************************************************************** Datafiles required for transportable tablespace TSET: /u01/app/oracle/oradata/normal/test01.dbf Job "SYS"."SYS_EXPORT_TRANSPORTABLE_01" successfully completed at 16:55:13 [oracle@normal normal]$ ls -l /u01/backup/ total 80 -rw-r----- 1 oracle oinstall 77824 Sep 14 16:55 test01.dmp -rw-r--r-- 1 oracle oinstall 1160 Sep 14 16:55 TSET.log
1)将表空间test 对应的数据文件copy到Target 对应的ORADATA目录下。
2)将expdp 导出的表空间metadta 数据copy 到Target 端的backup 目录下
--将表空间test 对应的数据文件copy到Target 对应的ORADATA目录下。 [oracle@normal normal]$ scp /u01/backup/test01.dmp 192.168.137.12:/u01/backup oracle@192.168.137.12 s password: test01.dmp 100% 76KB 76.0KB/s 00:00 --将expdp 导出的表空间metadta 数据copy 到Target 端的backup 目录下 [oracle@normal normal]$ scp test01.dbf 192.168.137.12:/u01/app/oracle/oradata/normal/test01.dbf oracle@192.168.137.12 s password: test01.dbf 100% 50MB 16.7MB/s 00:03 --在target端查看文件是否已经传输 [oracle@test ~]$ ll /u01/backup/ total 76 -rw-r----- 1 oracle oinstall 77824 Sep 14 17:03 test01.dmp [oracle@test ~]$ ll $ORACLE_BASE/oradata/normal/test01.dbf -rw-r----- 1 oracle oinstall 52436992 Sep 14 17:04 /u01/app/oracle/oradata/normal/test01.dbf
[oracle@test ~]$ impdp directory=backup dumpfile=test01.dmp transport_datafiles=/u01/app/oracle/oradata/normal/test01.dbf remap_schema=source_test:target_test logfile =test.log Import: Release 11.2.0.3.0 - Production on Sun Sep 14 17:09:25 2014 Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved. Username: / as sysdba Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production With the Partitioning, OLAP, Data Mining and Real Application Testing options Master table "SYS"."SYS_IMPORT_TRANSPORTABLE_01" successfully loaded/unloaded Starting "SYS"."SYS_IMPORT_TRANSPORTABLE_01": /********/ AS SYSDBA directory=backup dumpfile=test01.dmp transport_datafiles=/u01/app/oracle/oradata/normal/test01.dbf remap_schema=source_test:target_test logfile=test.log Processing object type TRANSPORTABLE_EXPORT/PLUGTS_BLK Processing object type TRANSPORTABLE_EXPORT/TABLE Processing object type TRANSPORTABLE_EXPORT/POST_INSTANCE/PLUGTS_BLK Job "SYS"."SYS_IMPORT_TRANSPORTABLE_01" successfully completed at 17:09:55
select tablespace_name, status from dba_tablespaces; TABLESPACE_NAME STATUS ------------------------------ --------- SYSTEM ONLINE UNDOTBS1 ONLINE SYSAUX ONLINE TEMPTS1 ONLINE USERS ONLINE OUTLN ONLINE TSET READ ONLY 7 rows selected. SQL> alter tablespace TSET read write; Tablespace altered.
SQL> conn target_test/oracle Connected. SQL> select * from t1; ID NAME ---------- ------------------------------ 1 AAAAA 2 BBBBB

热AI工具

Undresser.AI Undress
人工智能驱动的应用程序,用于创建逼真的裸体照片

AI Clothes Remover
用于从照片中去除衣服的在线人工智能工具。

Undress AI Tool
免费脱衣服图片

Clothoff.io
AI脱衣机

AI Hentai Generator
免费生成ai无尽的。

热门文章

热工具

记事本++7.3.1
好用且免费的代码编辑器

SublimeText3汉化版
中文版,非常好用

禅工作室 13.0.1
功能强大的PHP集成开发环境

Dreamweaver CS6
视觉化网页开发工具

SublimeText3 Mac版
神级代码编辑软件(SublimeText3)

Oracle 数据库日志的保留期限取决于日志类型和配置,包括:重做日志:由 "LOG_ARCHIVE_DEST" 参数配置的最大大小决定。归档重做日志:由 "DB_RECOVERY_FILE_DEST_SIZE" 参数配置的最大大小决定。在线重做日志:不归档,在数据库重启时丢失,保留期限与实例运行时间一致。审计日志:由 "AUDIT_TRAIL" 参数配置,默认保留 30 天。

Oracle 数据库启动顺序为:1. 检查前置条件;2. 启动监听器;3. 启动数据库实例;4. 等待数据库打开;5. 连接到数据库;6. 验证数据库状态;7. 启用服务(如果需要);8. 测试连接。

Oracle 所需内存量取决于数据库大小、活动水平和所需性能水平:用于存储数据缓冲区、索引缓冲区、执行 SQL 语句和管理数据字典缓存。具体数量受数据库大小、活动水平和所需性能水平影响。最佳实践包括设置适当的 SGA 大小、调整 SGA 组件大小、使用 AMM 和监控内存使用情况。

要在 Oracle 中查找字符出现的次数,执行以下步骤:获取字符串的总长度;获取字符所在子字符串的长度;计算字符出现的次数:用总长度减去子字符串长度。

Oracle 数据库服务器硬件配置要求:处理器:多核,主频至少 2.5 GHz,大型数据库建议 32 核以上。内存:小型数据库至少 8GB,中等规模 16-64GB,大型数据库或高负载工作负载高达 512GB 或更多。存储:SSD 或 NVMe 磁盘,RAID 阵列提高冗余和性能。网络:高速网络(10GbE 或更高),专用网卡,低延迟网络。其他:稳定电源、冗余组件、兼容操作系统和软件、散热和冷却系统。

上周,在内部的离职潮和外部的口诛笔伐之下,OpenAI可谓是内忧外患:-侵权寡姐引发全球热议-员工签署「霸王条款」被接连曝出-网友细数奥特曼「七宗罪」辟谣:根据Vox获取的泄露信息和文件,OpenAI的高级领导层,包括Altman在内,非常了解这些股权回收条款,并且签署了它们。除此之外,还有一个严峻而紧迫的问题摆在OpenAI面前——AI安全。最近,五名与安全相关的员工离职,其中包括两名最著名的员工,“超级对齐”团队的解散让OpenAI的安全问题再次被置于聚光灯下。《财富》杂志报道称,OpenA

70B模型,秒出1000token,换算成字符接近4000!研究人员将Llama3进行了微调并引入加速算法,和原生版本相比,速度足足快出了快了13倍!不仅是快,在代码重写任务上的表现甚至超越了GPT-4o。这项成果,来自爆火的AI编程神器Cursor背后团队anysphere,OpenAI也参与过投资。要知道在以快着称的推理加速框架Groq上,70BLlama3的推理速度也不过每秒300多token。 Cursor这样的速度,可以说是实现了近乎即时的完整代码文件编辑。有人直呼好家伙,如果把Curs

Oracle 可以通过以下步骤读取 dbf 文件:创建外部表,引用 dbf 文件;查询外部表,检索数据;将数据导入 Oracle 表。
