Home > Database > Mysql Tutorial > body text

oracle表空间&用户创建整理(来源于网络)

WBOY
Release: 2016-06-07 15:31:14
Original
1175 people have browsed it

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>
Copy after login
<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">
Copy after login
Copy after login
Copy after login
Copy after login
Copy after login
Copy after login
Copy after login
Copy after login
Copy after login
Copy after login
Copy after login
Copy after login
Copy after login
Copy after login
<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  用户名;
Copy after login

Copy after login
Copy after login
Copy after login
Copy after login
Copy after login
Copy after login
Copy after login
Copy after login
Copy after login
Copy after login
Copy after login
Copy after login
Copy after login
<span>表空间
建立表空间(一般建N个存数据的表空间和一个索引空间):
create tablespace 表空间名
datafile ' 路径(要先建好路径)\***.dbf  ' size *M
tempfile ' 路径\***.dbf ' size *M
autoextend on  --自动增长
--还有一些定义大小的命令,看需要
 default storage(
 initial 100K,
 next 100k,
);</span>
Copy after login
Copy after login
Copy after login
Copy after login
Copy after login
Copy after login
Copy after login
Copy after login
Copy after login
Copy after login
Copy after login
Copy after login
Copy after login
Copy after login
<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>
Copy after login
Copy after login
Copy after login
Copy after login
Copy after login
Copy after login
Copy after login
Copy after login
Copy after login
Copy after login
Copy after login
Copy after login
Copy after login
Copy after login
<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 表空间;
Copy after login
完整例子:
--1--表空间
CREATE TABLESPACE sdt
DATAFILE 'F:\tablespace\demo' size 800M
         EXTENT MANAGEMENT LOCAL SEGMENT SPACE MANAGEMENT AUTO; 
--索引表空间
CREATE TABLESPACE sdt_Index
DATAFILE 'F:\tablespace\demo' size 512M         
         EXTENT MANAGEMENT LOCAL SEGMENT SPACE MANAGEMENT AUTO;     


--2.建用户
create user demo identified by demo 
default tablespace demo;
 
--3.赋权
grant connect,resource to demo;
grant create any sequence to demo;
grant create any table to demo;
grant delete any table to demo;
grant insert any table to demo;
grant select any table to demo;
grant unlimited tablespace to demo;
grant execute any procedure to demo;
grant update any table to demo;
grant create any view to demo;
Copy after login
Copy after login
Copy after login
Copy after login
Copy after login
Copy after login
Copy after login
Copy after login
Copy after login
Copy after login
Copy after login
Copy after login
Copy after login
Copy after login
Copy after login
Copy after login
Copy after login
Copy after login
Copy after login
Copy after login
Copy after login
Copy after login
Copy after login
Copy after login
Copy after login
Copy after login
<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">
Copy after login
Copy after login
Copy after login
Copy after login
Copy after login
Copy after login
Copy after login
Copy after login
Copy after login
Copy after login
Copy after login
Copy after login
Copy after login
Copy after login
Copy after login
Copy after login
Copy after login
Copy after login
Copy after login
Copy after login
Copy after login
Copy after login
Copy after login
Copy after login
Copy after login
Copy after login
Copy after login
Copy after login
Copy after login
Copy after login
Copy after login
Copy after login
Copy after login
Copy after login
Copy after login
Copy after login
Copy after login
Copy after login
Copy after login
Copy after login
Copy after login
Copy after login
Copy after login
Copy after login
Copy after login
Copy after login
Copy after login
Copy after login
Copy after login
Copy after login
Copy after login
Copy after login
Copy after login
Copy after login
Copy after login
Copy after login
Copy after login
Copy after login
Copy after login
Copy after login
Copy after login
Copy after login
Copy after login
Copy after login
Copy after login
Copy after login
Copy after login
Copy after login
Copy after login
Copy after login
Copy after login
Copy after login
Copy after login
Copy after login
Copy after login
Copy after login
Copy after login
Copy after login
Copy after login
Copy after login
Copy after login
Copy after login
Copy after login
Copy after login
Copy after login
Copy after login
Copy after login
Copy after login
Copy after login
Copy after login
Copy after login
Copy after login
Copy after login
Copy after login
Copy after login
Copy after login
Copy after login
Copy after login
Copy after login
Copy after login
Copy after login
Copy after login
Copy after login
Copy after login
Copy after login
Copy after login
Copy after login
Copy after login
Copy after login
Copy after login
Copy after login
Copy after login
Copy after login
Copy after login
Copy after login
Copy after login
Copy after login
Related labels:
source:php.cn
Previous article:学习android JNI的那些事儿--------5. Field &amp; Method --&g Next article:bootstrap 2.3版与3.0版的使用区别
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Articles by Author
Latest Issues
Related Topics
More>
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!