Oracle 11g Express 安裝記錄(windows)

安裝後運行sql

step1:數據庫

修改tnsnames.ora 和 listener.ora 確保HOST設置一致oracle

位置:app

{軟件安裝目錄}\app\oracle\product\11.2.0\server\network\ADMIN\listener.oraide

SID_LIST_LISTENER =
  (SID_LIST =
    (SID_DESC =
      (SID_NAME = PLSExtProc)
      (ORACLE_HOME = D:\dev\OracleXE11\app\oracle\product\11.2.0\server)
      (PROGRAM = extproc)
    )
    (SID_DESC =
      (SID_NAME = CLRExtProc)
      (ORACLE_HOME = D:\dev\OracleXE11\app\oracle\product\11.2.0\server)
      (PROGRAM = extproc)
    )
  )

LISTENER =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1))
      (ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
    )
  )

DEFAULT_SERVICE_LISTENER = (XE)

{軟件安裝目錄}\app\oracle\product\11.2.0\server\network\ADMIN\tnsnames.oraspa

XE =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = XE)
    )
  )

EXTPROC_CONNECTION_DATA =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1))
    )
    (CONNECT_DATA =
      (SID = PLSExtProc)
      (PRESENTATION = RO)
    )
  )

ORACLR_CONNECTION_DATA =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1)) 
    )
    (CONNECT_DATA =
      (SID = CLRExtProc) 
      (PRESENTATION = RO) 
    )
  )

運行Start Database
step2:命令行

運行 SQL 命令行server

如下全爲命令行操做:table

-- 登錄system軟件

conn system/1q2w3e4r

-- 刪除用戶mydba

drop user mydba cascade;

-- 建立用戶mydba,by後爲密碼

create user mydba identified by mydba;

-- 受權mydba

grant connect,resource,dba,select any table to mydba;

-- 查看用戶所屬表空間

select username,default_tablespace from dba_users;

-- 表空間

alter user mydba default tablespace users;

-- 查看錶空間物理文件的名稱及大小

SELECT
    tablespace_name,
    file_id,
    file_name,
    round(bytes / (1024 * 1024), 0) total_space_mb
FROM dba_data_files
ORDER BY tablespace_name;

-- 更新maxsize

alter database datafile 'D:\DEV\ORACLEXE11\APP\ORACLE\ORADATA\XE\USERS.DBF' resize 7500M;
alter database datafile 'D:\DEV\ORACLEXE11\APP\ORACLE\ORADATA\XE\SYSTEM.DBF' resize 2000M;
alter database datafile 'D:\DEV\ORACLEXE11\APP\ORACLE\ORADATA\XE\UNDOTBS1.DBF' resize 2000M;

-- 查看錶空間和使用率

SELECT
    a.tablespace_name                      "表空間名",
    total                                  "表空間大小",
    free                                   "表空間剩餘大小",
    (total - free)                         "表空間使用大小",
    total / (1024 * 1024 * 1024)           "表空間大小(G)",
    free / (1024 * 1024 * 1024)            "表空間剩餘大小(G)",
    (total - free) / (1024 * 1024 * 1024)  "表空間使用大小(G)",
    round((total - free) / total, 4) * 100 "使用率 %"
FROM (SELECT
          tablespace_name, SUM(bytes) free
      FROM dba_free_space
      GROUP BY tablespace_name) a,
    (SELECT
         tablespace_name, SUM(bytes) total
     FROM dba_data_files
     GROUP BY tablespace_name) b

-- 執行SQL文件

@D:/data.sql

step2:

連接數據庫

相關文章
相關標籤/搜索