1 create tablespace db_name 2 datafile 'D:\oracle\product\10.2.0\oradata\orcl\db_name_.dbf' size 200M 3 autoextend on next 10M maxsize unlimited logging 4 extent management local autoallocate 5 segment space management auto; 解释: 1. 创建
1 create tablespace db_name
2 datafile 'D:\oracle\product\10.2.0\oradata\orcl\db_name_.dbf' size 200M
3 autoextend on next 10M maxsize unlimited logging
4 extent management local autoallocate
5 segment space management auto;
解释:
<span>1. 创建表空间,名称为db_name; 2. 表空间有一个数据文件*.dbf,大小为200MB; 3. 允许表空间自动扩展(autoextends),每次增长10MB(next 10M),并且不限制最大大小; 4. 说明表空间本地(local)管理,并自动分配范围(autoallocate),用户不能指定范围的大小; 5. 段空间(segment)的空间管理上使用bitmaps(auto)来管理数据块。使用AUTO会比使用MANUAL有更好的空间利用率,与效能上的提升。</span>
<p></p><p></p><p><span></span></p><span>Oracle建立表空间和用户 </span><div class="code" style="position:relative; padding:0px; margin:0px;"><div class="code" style="position:relative; padding:0px; margin:0px;"><div class="code" style="position:relative; padding:0px; margin:0px;"><div class="code" style="position:relative; padding:0px; margin:0px;"><div class="code" style="position:relative; padding:0px; margin:0px;"><div class="code" style="position:relative; padding:0px; margin:0px;"><div class="code" style="position:relative; padding:0px; margin:0px;"><div class="code" style="position:relative; padding:0px; margin:0px;"><div class="code" style="position:relative; padding:0px; margin:0px;"><div class="code" style="position:relative; padding:0px; margin:0px;"><div class="code" style="position:relative; padding:0px; margin:0px;"><div class="code" style="position:relative; padding:0px; margin:0px;"><div class="code" style="position:relative; padding:0px; margin:0px;"><pre class="brush:php;toolbar:false">
<span>建立表空间和用户的步骤: 用户 建立:create user 用户名 identified by "密码"; 授权:grant create session to 用户名; grant create table to 用户名; grant create tablespace to 用户名; grant create view to 用户名;<span> </span> </span><pre class="brush:php;toolbar:false">建立表空间和用户的步骤: 用户 建立:create user 用户名 identified by "密码"; 授权:grant create session to 用户名; grant create table to 用户名; grant create tablespace to 用户名; grant create view to 用户名;
<span>表空间 建立表空间(一般建N个存数据的表空间和一个索引空间): create tablespace 表空间名 datafile ' 路径(要先建好路径)\***.dbf ' size *M tempfile ' 路径\***.dbf ' size *M autoextend on --自动增长 --还有一些定义大小的命令,看需要 default storage( initial 100K, next 100k, );</span>
<span>例子:创建表空间 create tablespace DEMOSPACE datafile 'E:/oracle_tablespaces/DEMOSPACE_TBSPACE.dbf' size 1500M autoextend on next 5M maxsize 3000M; 删除表空间 drop tablespace DEMOSPACE including contents and datafiles</span>
<span>用户权限 授予用户使用表空间的权限: alter user 用户名 quota unlimited on 表空间; 或 alter user 用户名 quota *M on 表空间;</span><p></p><p></p><pre class="brush:php;toolbar:false">用户权限 授予用户使用表空间的权限: alter user 用户名 quota unlimited on 表空间; 或 alter user 用户名 quota *M on 表空间;
<span>--导入导出命令 ip导出方式: exp demo/demo@127.0.0.1:1521/orcl file=f:/f.dmp full=y exp demo/demo@orcl file=f:/f.dmp full=y imp demo/demo@orcl file=f:/f.dmp full=y ignore=y </span><p></p><p></p><p><span>只导出表结构:</span></p><p><span>PLSQL里</span></p><p><span> tools下</span></p><p><span> export user objects of</span></p><p><span> 按shift批量选择表</span></p><p><span> 执行就行了</span></p> <div class="code" style="position:relative; padding:0px; margin:0px;"><div class="code" style="position:relative; padding:0px; margin:0px;"><div class="code" style="position:relative; padding:0px; margin:0px;"><div class="code" style="position:relative; padding:0px; margin:0px;"><div class="code" style="position:relative; padding:0px; margin:0px;"><div class="code" style="position:relative; padding:0px; margin:0px;"><div class="code" style="position:relative; padding:0px; margin:0px;"><div class="code" style="position:relative; padding:0px; margin:0px;"><div class="code" style="position:relative; padding:0px; margin:0px;"><div class="code" style="position:relative; padding:0px; margin:0px;"><div class="code" style="position:relative; padding:0px; margin:0px;"><div class="code" style="position:relative; padding:0px; margin:0px;"><div class="code" style="position:relative; padding:0px; margin:0px;"><pre class="brush:php;toolbar:false">