前端之家收集整理的这篇文章主要介绍了
Oracle冷备份和恢复-造数据,
前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
1、创建空间 create tablespace pionner_data datafile 'C:\orcl1122\disk8\PIONEER_DATA.DBF' size 100M extent managerment local uniform size 1M; create tablespace pionner_indx datafile 'C:\orcl1122\disk8\PIONEER_INDX.DBF' size 100M extent managerment local uniform size 1M; 2、创建
用户 sql> create user nezha 2 identified by nezha 3 default tablespace pioneer_data 4 temporary tablespace temp 5 quota 100M on pioneer_data 6 quota 100M on pioneer_indx; User created 3、授权
sql> grant connect,resource,select any table to nezha; Grant succeeded 4、解锁sh
用户 sql> alter user sh identified by sh account unlock; User altered 5、
查询sh
用户下的客户表和销售表数据
sql> select count(*) from customers; COUNT(*) ---------- 55500
sql> select count(*) from sales; COUNT(*) ---------- 918843 6、在nezha
用户下创建表 利用sh表的数据sh.sales;sh.customers;
sql> create table sales as select * from sh.sales; Table created
sql> create table customers as select * from sh.customers; Table created 7、为哪吒
用户 销售表创建3个索引:
sql> create index sales_prod_id on sales(prod_id) tablespace pioneer_indx; Index created
sql> create index sales_cust_id on sales(cust_id) tablespace pioneer_indx; Index created
sql> create index sales_channel_id on sales(channel_id) tablespace pioneer_indx; Index created 8、为nezha
用户的客户表创建2个索引:
sql> create index customers_gender_idx on customers(cust_gender) tablespace pioneer_indx; Index created
sql> create index customers_city_idx on customers(cust_city) tablespace pioneer_indx; Index created 9、查看以上创建的信息 表信息
sql> select table_name,tablespace_name from user_tables; TABLE_NAME TABLESPACE_NAME ------------------------------ ------------------------------ CUSTOMERS PIONEER_DATA SALES PIONEER_DATA 索引信息
sql> select index_name,table_name,tablespace_name,status 2 from user_indexes; INDEX_NAME TABLE_NAME TABLESPACE_NAME STATUS ------------------------------ ------------------------------ ------------------------------ -------- CUSTOMERS_GENDER_IDX CUSTOMERS PIONEER_INDX VALID CUSTOMERS_CITY_IDX CUSTOMERS PIONEER_INDX VALID SALES_PROD_ID SALES PIONEER_INDX VALID SALES_CUST_ID SALES PIONEER_INDX VALID SALES_CHANNEL_ID SALES PIONEER_INDX VALID