Various concepts and components of Oracle database

1. Database space
create tablespace danny_space datafile 'C:\oraclexe\app\oracle\oradata\XE\danny_space_data.dbf' size 500M;



SELECT tablespace_name,
         SUM(bytes) bytes,
         MAX(bytes) largest
    FROM dba_free_space
   Group By Tablespace_Name;


select tablespace_name from dba_tablespaces;


There is an oradata folder under your database path, which contains a database space file of Oracle, and the database information is here.

quote
Where 'news_tablespace' is your custom tablespace name, you can name it arbitrarily; 'F:\oracle\product\10.1.0\oradata\news\news_data.dbf' is the storage location of data files, 'news_data.dbf' The file name is also arbitrary; 'size 500M' specifies the size of the data file, that is, the size of the table space.


quote
tablespace DANNY_SPACE created.



2. Create user
create user zhu identified by zhu default tablespace danny_space under the space;

quote
Format: create user username identified by password default tablespace tablespace table;


quote
user ZHU created.


3. Authorize users

grant connect, resource to news; -- means grant connect, resource permissions to news users
grant dba to news; -- means grant dba permissions to news users

grant dba to Zhu;




Create space and auto-increment space
create tablespace BTADATA datafile '/home/app/oracle/oradata/ifp30/BTADATA.dbf' size 100M autoextend on next 50M;

delete table space:
DROP TABLESPACE table_space name INCLUDING CONTENTS AND DATAFILES;

change automatic extension Attribute
alter database datafile 
    '/home/app/oracle/oradata/oracle8i/sales01.dbf', 
    '/home/app/oracle/oradata/oracle8i/sales02.dbf' 
    '/home/app/oracle/oradata/oracle8i/sales01 .dbf 
    autoextend off;

add data files for tablespace:
    alter tablespace sales add 
    datafile '/home/app/oracle/oradata/oracle8i/sales02.dbf' size 800M 
    autoextend on next 50M 
    maxsize 1000M;



drop tablespace xxx including contents and datafiles


3. Create the table
CREATE TABLE "ZHU"."GCFW_APPLICATION"
   (	"APPLICATION_ID" NUMBER NOT NULL ENABLE,
	"NAME" VARCHAR2(64 CHAR) NOT NULL ENABLE,
	"STATE" VARCHAR2(32 CHAR),
	"LOG_LEVEL" VARCHAR2(32 CHAR),
	"CREATED_BY" VARCHAR2(30) NOT NULL ENABLE,
	"UPDATED_AT" TIMESTAMP (6) WITH TIME ZONE,
	"UPDATED_BY" VARCHAR2(30),
	"CREATED_AT" TIMESTAMP (6) WITH TIME ZONE,
	"CREATED_FROM" VARCHAR2(100) DEFAULT SYS_CONTEXT('USERENV','HOST'),
	"UPDATED_FROM" VARCHAR2(100),
	 CONSTRAINT "PK_1031" PRIMARY KEY ("APPLICATION_ID")
  USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS
  TABLESPACE "DANNY_SPACE"  ENABLE
   )  
  PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255
 Nocompress Logging
  TABLESPACE "DANNY_SPACE"


quote

After the table is created, the ddl parameters of the table can be obtained again:
type, object name, schema name (schema name is user name)
SELECT DBMS_METADATA.GET_DDL('TABLE','GCFW_APPLICATION','ZHU') FROM DUAL;

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=327060183&siteId=291194637