oracle语句
1.进入数据库:sqlplus / as sysdba (以database admin身份进入oracle)
2.链接数据库:connect system (SID)
3.显示当前用户:select user from dual;
4.查询当前系统时间:select sysdate fromdual;
5.创建新用户:SQL> CREATE USER jerry
2 IDENTIFIED BY tom
3 ACCOUNT UNLOCK;
6.授予新用户权限:SQL> GRANT CONNECT TO jerry;
授权成功。
SQL> GRANT RESOURCE TO jerry;
授权成功。
SQL>
7.1.查询表所占内存大小:
SQL> SELECT segment_name AS TABLENAME,
2 BYTES B,
3 BYTES / 1024 KB,
4 BYTES / 1024 / 1024 MB
5 FROM user_segments
6 where segment_name in ('DIM_CUSTOMER', 'FACT_SALES_INVC', 'FACT_SALES_ITEM',
7 'DIM_STORE', 'DIM_INVN_ITEM')
8 order by bytes desc;
TABLENAME B KB MB
------------------------ ---------- ---------- ----------
FACT_SALES_ITEM 184549376 180224 176
FACT_SALES_INVC 146800640 143360 140
DIM_CUSTOMER 75497472 73728 72
DIM_INVN_ITEM 49283072 48128 47
DIM_STORE 65536 64 0.0625
或者:SELECT segment_name AS TABLENAME,BYTES B,BYTES / 1024 KB,BYTES / 1024 / 1024 MB FROM user_segments where segment_name='VENDOR_MASTER';(VENDOR_MASTER是表名,必须大写)