前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >创建表空间、用户、扩容、移动数据文件

创建表空间、用户、扩容、移动数据文件

作者头像
bisal
发布2019-01-29 11:00:06
8980
发布2019-01-29 11:00:06
举报
文章被收录于专栏:bisal的个人杂货铺

1、创建新的表空间;

2、创建用户;

3、通过修改文件大小与增加文件的方式扩容表空间;

4、人为移动数据文件,检验创建表的效果;

1、创建新的表空间;

SQL> create tablespace test_data   2  logging   3  datafile '/opt/oracle/oradata/bisal/test_data_01.dbf'   4  size 10M   5  autoextend on   6  next 10m maxsize 2000m   7  extent management local; Tablespace created.

[oracle@liu bisal]$ ls -rlht total 1.5G -rw-r----- 1 oracle oinstall  11M Sep 27 22:56 test_data_01.dbf

2、创建用户;

SQL> create user test_data identified by test_data   2  default tablespace test_data   3  temporary tablespace tempts1; User created.

SQL> select username from dba_users; USERNAME ------------------------------ TEST_DATA

3、通过修改文件大小与增加文件的方式扩容表空间;

SQL> alter database datafile '/opt/oracle/oradata/bisal/test_data_01.dbf' resize 25m; Database altered.

[oracle@liu bisal]$ ls -rlht total 1.5G -rw-r----- 1 oracle oinstall  26M Sep 27 23:01 test_data_01.dbf

SQL> alter tablespace test_data add datafile '/opt/oracle/oradata/bisal/test_data_02.dbf' size 3m; Tablespace altered.

[oracle@liu bisal]$ ls -rlht total 1.5G -rw-r----- 1 oracle oinstall  26M Sep 27 23:01 test_data_01.dbf -rw-r----- 1 oracle oinstall 3.1M Sep 27 23:03 test_data_02.dbf

4、人为移动数据文件,检验创建表的效果;

mv test_data_01.dbf ../.

mv test_data_02.dbf ../.

用该用户登录之前需要赋予相关权限:

CREATE SESSION权限:

[oracle@liu Desktop]$ sqlplus test_data/test_data SQL*Plus: Release 10.2.0.1.0 - Production on Fri Sep 27 23:40:23 2013 Copyright (c) 1982, 2005, Oracle.  All rights reserved. ERROR: ORA-01045: user TEST_DATA lacks CREATE SESSION privilege; logon denied Enter user-name:  ERROR: ORA-01017: invalid username/password; logon denied Enter user-name: ERROR: ORA-01017: invalid username/password; logon denied

SP2-0157: unable to CONNECT to ORACLE after 3 attempts, exiting SQL*Plus

CREATE TABLE权限:

SQL> create table test (x int); create table test (x int) * ERROR at line 1: ORA-01031: insufficient privileges

SQL> grant create table to test_data; Grant succeeded.

增加用户在表空间的使用量限制:

SQL> create table test (x int); create table test (x int) * ERROR at line 1: ORA-01950: no privileges on tablespace 'TEST_DATA'

创建时错误:

SQL> create table test(x int); create table test(x int) * ERROR at line 1: ORA-01116: error in opening database file 7 ORA-01110: data file 7: '/opt/oracle/oradata/bisal/test_data_02.dbf' ORA-27041: unable to open file Linux Error: 2: No such file or directory Additional information: 3

SQL> create table test(x int); Table created.

本文参与 腾讯云自媒体同步曝光计划,分享自作者个人站点/博客。
原始发表:2013年09月28日,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档