Oracle移动datafile的位置
随着时间的推移,有可能原来没有规划好的数据文件所在的盘空间已经不够了,或者我们有需要把一个datafile移动好其他的地方,这时候我们改如何操作呢?
这里有最简单的一个方法
1. offline数据文件所被包含的tablespace,
alter tablespace testts offline;
2. rename 原有的datafile指向新的路径
#cp /opt/oracle/oradata/orcl/testts01.dbf /opt/oracle/oradata/test/testts01.dbf
SQL>alter tablespace testts rename datafile ‘/opt/oracle/oradata/orcl/testts01.dbf’
to ‘/opt/oracle/oradata/test/testts01.dbf’;
或者用datafile 序号
alter tablespace testts rename datafile 3
to ‘/opt/oracle/oradata/test/testts01.dbf’;
3. online已经改好的tablespace
SQL> alter tablespace testts online;
自此操作完成。
相关文档:
select a.constraint_name, a.table_name, b.constraint_name
from user_constraints a, user_constraints b
where a.constraint_type = 'R'
and b.constraint_type = 'P'
and a.r_constraint_name = b.constraint_name
P 代表主键
R 代表外键 ......
最近,ORACLE系统基本调试通过,是时候设置ORACLE随RHEL自动启动与关闭服务的时候了,之所以把这个任务放在最后来做,是因为我觉得这个应该不会很难,但真正实施起来,还是遇到了个不小的障碍
写好脚本,注册好服务之后,经测试,ORACLE可以随RHEL启动而启动,但不能随系统关闭而关闭。在网上找答案,发现几乎所有的设置过 ......
1.建表空间
create tablespace OSDB datafile 'F:\oracle\oradata\glsqjz\OSDB.ora' size 100m reuse default storage(initial 500k next 500k pctincrease 20);
2.建用户
create user OSUSER identified by OSUSER;//identified by 后面的是密码,前面的是用户名
3.用户授权
grant resource,connect,RECOVERY ......
查找数据库中所有字段 以对应的表
select C.column_name,C.TABLE_NAME from dba_tab_columns C where owner=''
查每个科目class 分数scro前三名
select id, name, class, scro
from (select row_number() over(partition by class order by scro desc) cnt,
&n ......
1、使用oracle用户登录,连接数据库
[oracle@wuzj ~]$ sqlplus /nolog
SQL*Plus: Release 10.2.0.1.0 - Production on Thu Feb 26 12:06:29 2009
Copyright (c) 1982, 2005, Oracle. All rights reserved.
SQL> conn /as sysdba
Connected.
//查看用户
SQL> select username,password from dba_users;
......