网站首页 > 技术文章 正文
如果手机上显示代码错乱,请分享到QQ或者其他地方,用电脑查看!!!
Oracle转移数据库表空间文件位置
工作中碰到的一次windows因数据库表空间所在的磁盘不足,需要进行迁移的解决方法,最后网上搜索得到的方法,自己用了很多次,挺好用:
操作如下:
1、用dba权限账户登录数据库(这里用的是system账户)
在cmd中输入:sqlplus /nolog
conn system/system@orc (账户:system,密码:system,数据库实例名:orc)
2、修改表空间为offline状态
alter tablespace YUANYT offline;( YUANYT为数据库表空间名称)
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';
5、修改表空间为Online状态
alter tablespace YUANYT online;
6、查看修改后的表空间文件存储位置
select file_name from sys.dba_data_files; (最后一行数据显示:数据文件存储位置已转移到D盘)
7、最后提交操作
commit;
db2因表空间不足导致load失败,并将表变为load pending状态
之所以选用load方式导入数据是如果用import导入会生成大量事务日志,所以就放弃了,改用了load
自己不是做数据库的所以这点不懂,折腾了好一会,下面是解决方法:
环境:
a.查看当前系统cat /etc/redhat-release
[root@nginx/]
# cat /etc/redhat-release
CentOSrelease 6.7 (Final)
[root@nginx/]
#
b.查看系统内核uname –r
[root@nginx/]
# uname -r
2.6.32-573.el6.x86_64
[root@nginx/]
#
c.查看db2版本,db2level
[db2inst1@db2~]$ db2level
DB21085I This instance or
install
(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"可以查看表状态
[db2inst1@db2 bk]$ db2
"load query table text_attachment"
SQL3501W Thetable space(s)
in
which
the table resides will not be placed
in
backup pending state since forward recovery is disabledfor the database.
SQL3109N Theutility is beginning to load data from
file
"/mnt/bk/bk/empty.txt"
.
SQL2036N The pathfor the
file
, named pipe, or device
"/mnt/bk/bk/empty.txt"
is not valid.
SQL1652N File I
/Oerror
occurred.
SQL3532I The Loadutility is currently
in
the
"LOAD"
phase.
Number of rows
read
= 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,网上很多人说可以没有也可以是空的,但我测试
的时候是没有这个文件不管用,提示如下错误:
[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 placed
in
backup pending state since forward recovery is disabledfor the database.
SQL3109N Theutility is beginning to load data from
file
"/mnt/bk/bk/empty.txt"
.
SQL2036N The pathfor the
file
, named pipe, or device
"/mnt/bk/bk/empty.txt"
is not valid.
SQL1652N File I
/O
error occurred.
SQL1652N File I
/O
error occurred.
我就新建了一个这个空文件。再次执行上述命令:
[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 placed
in
backup pending state since forward recovery is disabledfor the database.
SQL3110N Theutility has completed processing.
"0"
rows were
read
from the
input
file
.
Number of rows
read
= 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 表的状
态:
[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,用起来方便点。
以上是全部内容,只是善于分享,不足之处请包涵!爬虫基本的原理就是,获取源码,进而获取网页内容。一般来说,只要你给一个入口,通过分析,可以找到无限个其他相关的你需要的资源,进而进行爬取。
我也写了很多其他的非常简单的入门级的爬虫详细教程,关注后,点击我的头像,就可以查看到。
欢迎大家一起留言讨论和交流,谢谢!
猜你喜欢
- 2024-10-20 Kettle迁移Oracle数据到MySQL kettle数据库迁移
- 2024-10-20 使用 convert database 命令进行 RMAN 跨平台迁移(12C至19C)
- 2024-10-20 使用 convert database 命令进行 RMAN 跨平台迁移(同版本)
- 2024-10-20 最佳实践 | 提效 47 倍,制造业生产 Oracle 迁移替换
- 2024-10-20 Oracle 12c PDB迁移(一) oracle迁移到oceanbase
- 2024-10-20 0497-如何将Kerberos的CDH6.1从Oracle JDK 1.8迁移至OpenJDK 1.8
- 2024-10-20 将Oracle企业应用程序迁移到云端需要了解的信息
- 2024-10-20 阿里云PolarDB发布重大更新,支持Oracle等数据库一键迁移上云
- 2024-10-20 oracle高版本迁移数据到低版本 oracle 跨版本迁移
- 2024-10-20 阿里云PolarDB发布更新,支持Oracle等数据库一键迁移上云
你 发表评论:
欢迎- 最近发表
-
- 前端流行框架Vue3教程:13. 组件传递数据_Props
- 前端必看!10 个 Vue3 救命技巧,解决你 90% 的开发难题?
- JAVA和JavaScript到底是什么关系?是亲戚吗?
- Java和js有什么区别?(java和javascript的区别和联系)
- 东方标准|Web和Java的区别,如何选择这两个专业
- 前端面试题-JS 中如何实现大对象深度对比
- 360前端一面~面试题解析(360前端笔试)
- 加班秃头别慌!1 道 Vue 面试题,快速解锁大厂 offer 通关密码
- 焦虑深夜刷题!5 道高频 React 面试题,吃透 offer 稳了
- 2025Web前端面试题大全(整理版)面试题附答案详解,最全面详细
- 标签列表
-
- 前端设计模式 (75)
- 前端性能优化 (51)
- 前端模板 (66)
- 前端跨域 (52)
- 前端md5加密 (49)
- 前端路由 (55)
- 前端数组 (65)
- 前端定时器 (47)
- 前端懒加载 (45)
- 前端接口 (46)
- Oracle RAC (73)
- oracle恢复 (76)
- oracle 删除表 (48)
- oracle 用户名 (74)
- oracle 工具 (55)
- oracle 内存 (50)
- oracle 导出表 (57)
- oracle查询数据库 (45)
- oracle约束 (46)
- oracle 中文 (51)
- oracle链接 (47)
- oracle的函数 (57)
- mac oracle (47)
- 前端调试 (52)
- 前端登录页面 (48)
本文暂时没有评论,来添加一个吧(●'◡'●)