码迷,mamicode.com
首页 > 数据库 > 详细

oracle--块信息深入解析

时间:2019-04-16 17:42:25      阅读:195      评论:0      收藏:0      [点我收藏+]

标签:cdb   oracl   value   size   使用   default   sql   创建表   一个   

一,创建

  Data Block是数据库中最小的I/O单元

  01,建立一个新的表空间

  查看默认表空间位置

select TABLESPACE_NAME,FILE_NAME from dba_data_files;

  创建一个表空间放其他的地方把


create
tablespace test2 datafile /orcl/app/table/test2.dbf size 20m reuse autoextend on next 20m maxsize UNLIMITED extent management local;

  02,创建用户

查看CDB

select name,cdb from v$database;

查看pDb

SQL> select pdb_id,pdb_name,dbid,status,creation_scn from dba_pdbs;

    PDB_ID PDB_NAME DBID STATUS      CREATION_SCN
---------- -----------------------------------------------------------------------------------
     3 ORCLPDB   3877422513 NORMAL           1442756
     2 PDB$SEED   4118313826 NORMAL           1408751
     4 HRPDB   1506437541 NORMAL           4081006
     5 SALESPDB   1453096304 NORMAL           4087331

查看PDB状态

SQL> select con_id,dbid,NAME,OPEN_MODE from v$pdbs;

    CON_ID     DBID NAME      OPEN_MODE
---------- ---------- -----------------------------------------------------
     2 4118313826 PDB$SEED      READ ONLY
     3 3877422513 ORCLPDB      READ WRITE
     4 1506437541 HRPDB      READ ONLY
     5 1453096304 SALESPDB      READ ONLY

创建使用者为test

SQL> create user c##test identified by test;

User created.

切换PDB
SQL>  show con_name;

CON_NAME
------------------------------
CDB$ROOT
SQL> alter session set container=ORCLPDB;

Session altered.

SQL> show con_name;

CON_NAME
------------------------------
ORCLPDB
创建表空间
SQL> create tablespace test2 datafile ‘/orcl/app/table/test2.dbf‘ size 20M;

Tablespace created.

创建真正的用户

SQL> create user test identified by test default tablespace test2;

User created.
授予权限
SQL> grant dba to test

Grant succeeded.

  03,建立数据

SQL> create table t1 (id int,name varchar2(100));

Table created.

SQL> insert into t1 values(1,A);

1 row created.

SQL> alter system checkpoint;

System altered.

SQL> col name for a10
SQL> select  id,name,dbms_rowid.rowid_relative_fno(rowid) file#,dbms_rowid.rowid_block_number(rowid) block# from t1;

    ID NAME        FILE#     BLOCK#
---------- ---------- ---------- ----------
     1 A               1      32641

SQL> select p.spid from v$session s,v$process p where s.paddr=p.addr and s.sid in (select userenv(sid) from dual);

SPID
------------------------
17124

SQL>  alter system dump datafile 1 block 32641;

System altered.

SQL> select p.spid from v$session s,v$process p where s.paddr=p.addr and s.sid in (select userenv(sid) from dual);

SPID
------------------------
17124

SQL> select p.spid from v$session s,v$process p where s.paddr=p.addr and s.sid in (select userenv(sid) from dual);

SPID
------------------------
17124

SQL> select object_id from dba_objects where object_name=T1 and owner=SYS;

 OBJECT_ID
----------
     75798

 

http://www.itpub.net/thread-1772905-1-1.html

 

 

oracle--块信息深入解析

标签:cdb   oracl   value   size   使用   default   sql   创建表   一个   

原文地址:https://www.cnblogs.com/kingle-study/p/10718573.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!