Oracle入门第一天(下)——数据库的管理

一、SQL Developer的使用

  常用设置,参考:https://www.cnblogs.com/biGpython/archive/2012/03/30/2424739.html

          https://www.cnblogs.com/linjiqin/archive/2013/06/24/3152538.html

 没有监听程序请通过net-manage或者lilsten-ora配置文件https://blog.csdn.net/qq_27298687/article/details/89327728

  配置ora文件:https://blog.csdn.net/qq_36501591/article/details/87978676

    登录

  以SCOTT用户登录:

  

  登录页面:

  

  导入表:

  

 

.  将导入的表放到任意的位置:(这里选择D盘根目录)

  

  执行以下命令:顺序需要一致!

  

  

  

  通过查询来检测是否导入正确:107条记录找到则为正确!

  

  打开SQL窗口,工具栏->会话->执行可执行语句

 二、企业管理器

  日常使用的navicat,创建类似MySQL的“数据库”的流程如下:创建表空间->创建用户->对应空间

    https://blog.csdn.net/qiushisoftware/article/details/100734470

  通过所有程序->Oracle客户端->找到企业管理器控制台(Enterprise manager console)

  11g改版成为b/s架构了,可以简单参考:https://www.cnblogs.com/jifeng/archive/2013/04/25/3043756.html

  

  点开数据库ORCL进行登录:(使用系统用户进行登录)

  

 

  

   创建用户

  在上图的用户上右击两次,即可创建用户:

  

  

  之后也可以以此用户登录Developer了!——当然,他不能访问刚刚SCOTT通过文件创建的表

  对象

  要想进行访问,需要在企业管理器进行管理:

  

  展开表:

  

  这样,就可以通过JIANGBEI用户访问SCOTT用户对应表的对应权限了!

  系统

   给用户对应的权限(例如创建表) 

  

  限额

    给表空间分配物理空间,这样才能正确创建了!

  

  角色

  和权限管理一样,角色有对应权限的封装,属于某个角色拥有对应权限

  

  对应角色有哪些权限可以在用户下一栏进行查看

  

   查看版本:

select * from v$version

   数据库的系统表(通过以下三个表来导出所有表结构信息)

 DESC ALL_COL_COMMENTS ;
Name        Type           Nullable Default Comments              
----------- -------------- -------- ------- --------------------- 
OWNER       VARCHAR2(30)                    Owner of the object   
TABLE_NAME  VARCHAR2(30)                    Name of the object    
COLUMN_NAME VARCHAR2(30)                    Name of the column    
COMMENTS    VARCHAR2(4000) Y                Comment on the column 
ALL_COL_COMMENTS
desc ALL_TAB_COLUMNS;
Name                 Type          Nullable Default Comments                                                             
-------------------- ------------- -------- ------- -------------------------------------------------------------------- 
OWNER                VARCHAR2(30)                                                                                        
TABLE_NAME           VARCHAR2(30)                   Table, view or cluster name                                          
COLUMN_NAME          VARCHAR2(30)                   Column name                                                          
DATA_TYPE            VARCHAR2(106) Y                Datatype of the column                                               
DATA_TYPE_MOD        VARCHAR2(3)   Y                Datatype modifier of the column                                      
DATA_TYPE_OWNER      VARCHAR2(30)  Y                Owner of the datatype of the column                                  
DATA_LENGTH          NUMBER                         Length of the column in bytes                                        
DATA_PRECISION       NUMBER        Y                Length: decimal digits (NUMBER) or binary digits (FLOAT)             
DATA_SCALE           NUMBER        Y                Digits to right of decimal point in a number                         
NULLABLE             VARCHAR2(1)   Y                Does column allow NULL values?                                       
COLUMN_ID            NUMBER        Y                Sequence number of the column as created                             
DEFAULT_LENGTH       NUMBER        Y                Length of default value for the column                               
DATA_DEFAULT         LONG          Y                Default value for the column                                         
NUM_DISTINCT         NUMBER        Y                The number of distinct values in the column                          
LOW_VALUE            RAW(32)       Y                The low value in the column                                          
HIGH_VALUE           RAW(32)       Y                The high value in the column                                         
DENSITY              NUMBER        Y                The density of the column                                            
NUM_NULLS            NUMBER        Y                The number of nulls in the column                                    
NUM_BUCKETS          NUMBER        Y                The number of buckets in histogram for the column                    
LAST_ANALYZED        DATE          Y                The date of the most recent time this column was analyzed            
SAMPLE_SIZE          NUMBER        Y                The sample size used in analyzing this column                        
CHARACTER_SET_NAME   VARCHAR2(44)  Y                Character set name                                                   
CHAR_COL_DECL_LENGTH NUMBER        Y                Declaration length of character type column                          
GLOBAL_STATS         VARCHAR2(3)   Y                Are the statistics calculated without merging underlying partitions? 
USER_STATS           VARCHAR2(3)   Y                Were the statistics entered directly by the user?                    
AVG_COL_LEN          NUMBER        Y                The average length of the column in bytes                            
CHAR_LENGTH          NUMBER        Y                The maximum length of the column in characters                       
CHAR_USED            VARCHAR2(1)   Y                C if maximum length is specified in characters, B if in bytes        
V80_FMT_IMAGE        VARCHAR2(3)   Y                Is column data in 8.0 image format?                                  
DATA_UPGRADED        VARCHAR2(3)   Y                Has column data been upgraded to the latest type version format?     
HISTOGRAM            VARCHAR2(15)  Y 
ALL_TAB_COLUMNS
DESC ALL_TAB_COMMENTS;
Name       Type           Nullable Default Comments              
---------- -------------- -------- ------- --------------------- 
OWNER      VARCHAR2(30)                    Owner of the object   
TABLE_NAME VARCHAR2(30)                    Name of the object    
TABLE_TYPE VARCHAR2(11)   Y                Type of the object    
COMMENTS   VARCHAR2(4000) Y                Comment on the object 
ALL_TAB_COMMENTS

 

posted @ 2018-01-01 18:23  ---江北  阅读(293)  评论(0编辑  收藏  举报
TOP