Oracle Study Note : Tablespace and Data Files
1.how to create a tablespace that employs the most common features
create tablespace tb_name #create bigfile tablespace tb_name
datafile ‘/u01/dbfile/orcl/tb_name.dbf’
size 100m
autoextend on maxsize 1000m #don’t recommend use the AUTOEXTEND feature. if use this feature,suggest always specify a corresponding MAXSIZE.
extent management local #A locally managed tablespace uses a bitmap in the data file to efficiently determine whether an extent is in use
uniform size 128k #instruct Oracle to allocate size for each extent via the UNIFORM SIZE [size] clause.the default uniform extent size is 1MB
segment space management auto; #the SEGMENT SPACE MANAGEMENT AUTO clause instructs Oracle to manage the space within the block.
nologging; #you can turn off the generation of redo for direct path loading.
default row store compress advanced;
2.renameing a tablespace. When you rename a tablespace,Oracle updates the name of the tablespace in the data dictionary,control files,and data file headers. Keep in mind that renaming a tablespace doesn’t rename any associated data files.
SQL> alter tablespace old_name rename to new_name
3.alter a tablespace logging mode
SQL> alter tablespace tb_name nologging;
4.confirm the tablespace logging mode by querying the DBA_TABLESPACES view
SQL> select tablespace_name,logging from dba_tablespaces;
5.changing a tablespace’s write mode
SQL> alter tablespace tb_name read only; #you can’t make a tablespace that contains active rollback segment read-only.
SQL> alter tablespace tb_name read write;
SQL> alter table table_name read only; #modify individual tables
6.dropping a tablespace
SQL> alter tablespace tb_name offline; #before droping a tablespace,it’s a good practices to first it offline.
SQL> drop tablespace tb_name including contents and datafiles cascade constraints;
7.using Oracle Managed Files
a) DB_CREATE_FILE_DEST
b) DB_CREATE_ONLINE_LOG_DEST_N
c) DB_RECOVERY_FILE_DEST
SQL> alter system set db_create_file_dest=’/u01’;
8.enabling default table compression within a tablespace
SQL> alter tablespace tb_name default row store compress advanced;
SQL> alter tablespace tb_name defaule compress [basic | nocompres]
9.displaying oracle error messages and action
$ oerr ora 01653
10.altering tablespace size
SQL> alter database datafile ‘/u01/user01.dbf’ resize 1g;
SQL> alter tablespace users add datafile ‘/u02/users02.dbf’ size 100m;
SQL> alter tablespace big_data resize 1T; #with bigfile tablespace,you have the option of using the ALTER TABLESPACE statement to resize the data file. this works because only one data file can be associated with a bigfile tablespace.
11.to add space to a temporary tablespace
SQL> select name,bytes from v$tempfile; #first query the V$TEMPFILE view to verify the current size and location of temporary data files.
SQL> alter database tempfile ‘u01/temp01.dbf’ resize 500m;
SQL> alter tablespace temp add tempfile ‘u01/temp02.bdf’ size 5000m;
12.toggling data files offline and online
SQL> alter tablespace tb_name offline;
SQL> alter database datafile 4 offline for drop #if your database isn’t in archivelog mode,you must specify ALTER DATAFILE ... OFFLINE FOR DROP when taking a data file offline.When you use the OFFLINE FOR DROP clause, no checkpiont is taken on the data file, this means you need to perform media recovery on the data file before bringing it online.
SQL> recovery datafile 4;
13.renaming or relocating a data file.new in Oracle 12c is the ALTER DATABASE MOVE DATAFILE commend.this commend allows you to rename or move datafiles without any downtime.
SQL> alter database move datafile ‘u01/user01.dbf’ to ‘/u01/user02.dbf’;
SQL> alter database move datafile 4 to ‘u02/user01.dbf’ keep; #to keep a copy of the original file.
SQL> alter database move datafile 4 to ‘/u01/user02.dbf’ reuse; #specify the REUSE clause to overwrite an existing file.
Oracle Study Note : Tablespace and Data Files的更多相关文章
- Oracle Study Note : Users and Basic Security
1. view the default user account SQL> select username from dba_users; 2. lock all users and set t ...
- Oracle客户端工具出现“Cannot access NLS data files or invalid environment specified”错误的解决办法
Oracle客户端工具出现"Cannot access NLS data files or invalid environment specified"错误的解决办法 方法一:参考 ...
- Oracle Study之--Oracle 单实例11.2.0.1.0升级到11.2.0.3.0
Oracle Study之--Oracle 单实例11.2.0.1.0升级到11.2.0.3.0 系统环境: 操作系统:RedHat EL6(64位) Oracle: Oracle 11gR2 ...
- do export method of oracle all database tables with dmp files.
usually we need to export the database tables to backup and others use. So we must know what to do e ...
- ORA-12705: Cannot access NLS data files or invalid environment specified
ASM实例无法启动 [grid@data ~]$ sqlplus / as sysasm SQL*Plus: Release 11.2.0.4.0 Production on Fri Sep 11 0 ...
- Oracle 11gR2 Database和Active Data Guard迁移案例
客户一套核心系统由一台Oracle Database 11.2.0.3.4单机和一台Active Data Guard组成,分别运行在两台PC服务器上,Oracle Linux 5.8 x86_64b ...
- 17.1.1.6 Creating a Data Snapshot Using Raw Data Files 创建一个数据快照使用 Raw Data Files
17.1.1.6 Creating a Data Snapshot Using Raw Data Files 创建一个数据快照使用 Raw Data Files 如果数据库是大的, 复制raw 数据文 ...
- Oracle Study之-AIX6.1构建Oracle 10gR2 RAC(3)
Oracle Study之-AIX6.1构建Oracle 10gR2 RAC(3) 一.配置共享存储 [oracle@aix203 ~]$lsdev -c disk hdisk0 Available ...
- Oracle Study之-AIX6.1构建Oracle 10gR2 RAC(4)
Oracle Study之-AIX6.1构建Oracle 10gR2 RAC(4) 一.安装CRS补丁 在安装CRS之前,须要安装补丁p6718715_10203_AIX64-5L,否则在安装时会出现 ...
随机推荐
- 移动开发 android 入门开发 阶段视频
一直想把 android 的开发学习录制成视频,这里录制了一部分供大家学习. http://www.chuanke.com/s5402069.html 到这里,文档,源码,视频基本就全了,祝愿大家能够 ...
- 实验室中搭建Spark集群和PyCUDA开发环境
1.安装CUDA 1.1安装前工作 1.1.1选取实验器材 实验中的每台计算机均装有双系统.选择其中一台计算机作为master节点,配置有GeForce GTX 650显卡,拥有384个CUDA核心. ...
- No.009 Palindrome Number
9. Palindrome Number Total Accepted: 136330 Total Submissions: 418995 Difficulty: Easy Determine whe ...
- ionic cordova plugin simple demo
要用cordova plugin 的话还是需要设置一下的 1. 下载 ng-cordova.js download the zip file here 2. 在index.html 中引用 (cord ...
- Jmeter笔记1:使用Badboy录制脚本,作为JMeter测试的素材
接触Badboy,是因为JMeter要引用Badboy导出的脚本 Badboy的录制提供两个模式:Request(默认模式) 和navigation模式.点击下图N,切换模式:但是要导出到Jmeter ...
- poj1001_Exponentiation
这题真是超级大模拟.好繁琐,自己写的打数加法,乘法,写的比我大一时候写的要好很多,大一是借助C++里面的string来写的,这把只用了C,浇一次就ac了,挺开心的,不过写了2个小时啊.注意零的处理.大 ...
- Chrome 使用技巧
阅读目录 写在前面 快速切换文件 在源代码中搜索 在源代码中快速跳转到指定的行 使用多个插入符进行选择 设备模式 设备传感仿真 格式化凌乱的js源码 颜色选择器 改变颜色格式 强制改变元素状态(方便查 ...
- Linux日志
一.Linux 常見的日志文件 /var/log/cron:你的 crontab 排程有没有实际被进行? 进行过程有没有发生错误?你的 /etc/crontab 是否撰写正确?在这个登录档内查询看看. ...
- 设计模式-外观模式(Facade)
简介 外观模式(Facade),将外部与内部子系统的通信通过一个统一的门面对象进行. 由两部分组成: 门面角色:供外部调用,内部可能组装了多个子系统,多个方法. 子系统角色:子系统的方法也可以直接供外 ...
- iOS 开发经验谈,点击没响应事件