oracle imp导入表空间不足,Oracle转移数据库表空间文件,db2空间不足导致load失败(详细步骤)-dbf文件...

如果手机上显示代码错乱,请分享到QQ或者其他地方,用电脑查看!!!

Oracle转移数据库表空间文件位置

工作中碰到的一次windows因数据库表空间所在的磁盘不足,需要进行迁移的解决方法,最后网上搜索得到的方法,自己用了很多次,挺好用:

操作如下:

1、用dba权限账户登录数据库(这里用的是system账户)

在cmd中输入:sqlplus /nolog

conn system/system@orc (账户:system,密码:system,数据库实例名:orc)

20c75f6c2d9e02f9ab61cafc124b5aa8.png

2、修改表空间为offline状态

alter tablespace YUANYT offline;( YUANYT为数据库表空间名称)

af0ee7fb984b244b6c98379caa61c551.png

3、拷贝YUANYT数据表空间文件

将C:\oracledata\YUANYT_DATA.DBF文件拷贝到D:\oracledata\YUANYT_DATA.DBF。

4、修改oracle表空间指向地址.

alter database rename file 'C:\oracledata\YUANYT_DATA.DBF' to 'D:\oracledata\YUANYT_DATA.DBF';

6a19597645021daaceab368ae65a5e8f.png

5、修改表空间为Online状态

alter tablespace YUANYT online;

823b1812b2e2ce11df9c7710b40a1aab.png

6、查看修改后的表空间文件存储位置

select file_name from sys.dba_data_files; (最后一行数据显示:数据文件存储位置已转移到D盘)

6d10d389393be367b0b2866ad68b7d57.png

7、最后提交操作

commit;

db2因表空间不足导致load失败,并将表变为load pending状态

之所以选用load方式导入数据是如果用import导入会生成大量事务日志,所以就放弃了,改用了load

自己不是做数据库的所以这点不懂,折腾了好一会,下面是解决方法:

环境:

a.查看当前系统cat /etc/redhat-release

1

2

3

[root@nginx/]# cat /etc/redhat-release

CentOSrelease 6.7 (Final)

[root@nginx/]#

b.查看系统内核uname –r

1

2

3

[root@nginx/]# uname -r

2.6.32-573.el6.x86_64

[root@nginx/]#

c.查看db2版本,db2level

1

2

3

4

5

6

7

8

9

[db2inst1@db2~]$ db2level

DB21085I This instance orinstall (instance name,where applicable:

"db2inst1")uses"64" bits and DB2 code release"SQL10057" with level

identifier"0608010E".

Informationaltokens are"DB2 v10.5.0.7","s151221","IP23956",and Fix Pack

"7".

Productis installed at"/opt/ibm/db2/V10.5".

[db2inst1@db2~]$

1、查看日志,有如下错误:

SQL0289N Unableto allocate new pages in table space "XXXX".

SQLSTATE=57011

将表空间大小修改后,查看这个表的状态:

a.通过这个命令:db2 "load query table XXX"可以查看表状态

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

[db2inst1@db2 bk]$ db2"load query table text_attachment"

SQL3501W Thetable space(s)in which the table resides will not be placedin

backup pending state since forward recovery is disabledfor the database.

SQL3109N Theutility is beginning to load data fromfile

"/mnt/bk/bk/empty.txt".

SQL2036N The pathfor thefile, named pipe, or device"/mnt/bk/bk/empty.txt"

is not valid.

SQL1652N File I/Oerror occurred.

SQL3532I The Loadutility is currentlyin the"LOAD" phase.

Number of rowsread = 0

Number of rows skipped = 0

Number of rows loaded = 0

Number of rows rejected = 0

Number of rows deleted = 0

Number of rows committed = 0

Number of warnings = 0

Tablestate:

Load Pending

b.所以需要先解锁Load Pending状态

db2 "load from /mnt/bk/bk/empty.txt of ixf restart/terminate into text_attachment"

注意:

直接上述命令中empty.txt,网上很多人说可以没有也可以是空的,但我测试

的时候是没有这个文件不管用,提示如下错误:

1

2

3

4

5

6

7

8

9

10

11

12

13

[db2inst1@db2 bk]$ db2"load from/mnt/bk/bk/empty.txt of ixf restart into text_attachment"

SQL3501W Thetable space(s)in which the table resides will not be placedin

backup pending state since forward recovery is disabledfor the database.

SQL3109N Theutility is beginning to load data fromfile

"/mnt/bk/bk/empty.txt".

SQL2036N The pathfor thefile, named pipe, or device"/mnt/bk/bk/empty.txt"

is not valid.

SQL1652N File I/O error occurred.

SQL1652N File I/O error occurred.

我就新建了一个这个空文件。再次执行上述命令:

1

2

3

4

5

6

7

8

9

10

11

12

13

14

[db2inst1@db2 bk]$ db2"load from/mnt/bk/bk/empty.txt of ixf terminate into text_attachment"

SQL3501W Thetable space(s)in which the table resides will not be placedin

backup pending state since forward recovery is disabledfor the database.

SQL3110N Theutility has completed processing."0" rows wereread from the

inputfile.

Number of rowsread = 0

Number of rows skipped = 0

Number of rows loaded = 0

Number of rows rejected = 0

Number of rows deleted = 0

Number of rows committed = 0

这样就表示成功了然后,查看我刚才被Load Pending 表的状

态:

1

2

3

4

[db2inst1@db2 bk]$ db2"load query tabletext_attachment"

Tablestate:

Normal

[db2inst1@db2 bk]$

2、对上述问题的分析:

load后面可以跟三个参数:默认为copy NO;copy YES;NONRECOVERABLE

(1)对于DMS表空间,load默认为copy NO模式,load完成后,表空间会出去暂挂状态,这个时候只能查询表中的数据,需要对表空间进行一次备份才可以对表进行update,insert等操作。

(2)如果是copy YES ,load完成后会自动进行一次备份操作;

(3)如果是NONRECOVERABLE,这样load数据是不可恢复的,此命令不会昌盛表空间暂挂,也不会自动进行表空间备份,但是有一个缺点:不能恢复,当数据库进行回滚的时候,不能还原,相对来说比较危险,但是个人觉得还是这个用起来方便

当上述解决了Load Pending之后就可以正常导入数据了。我后用的NONRECOVERABLE,用起来方便点。

以上是全部内容,只是善于分享,不足之处请包涵!爬虫基本的原理就是,获取源码,进而获取网页内容。一般来说,只要你给一个入口,通过分析,可以找到无限个其他相关的你需要的资源,进而进行爬取。

我也写了很多其他的非常简单的入门级的爬虫详细教程,关注后,点击我的头像,就可以查看到。

欢迎大家一起留言讨论和交流,谢谢!

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值