oracle でつかいそうな設定とかコマンドとかリファレンスとかスクリプトとか


ここなかなかよいです。かゆいところにてが届く感じ。

Oracle管理者のためのSQLリファレンス

http://www.atmarkit.co.jp/fdb/ref/ref_oracle.html


テーブル(オブジェクト)一覧のテーブル
all_objects

列名(カラム)の一覧
all_tab_columns



うちの実験機の場合

[root@cent5-64b-40 ~]# cat /etc/init.d/dbora 
#! /bin/bash
#
# dbora       Startup Script Oracle Database 11g
#
# chkconfig: 345 99 10
# description: Oracle Database 11g
# Source function library.
. /etc/rc.d/init.d/functions

# Oracle Database 11g
ORACLE_BASE=/opt/oracle/app
ORACLE_HOME=${ORACLE_BASE}/product/11.2.0/dbhome_1
ORACLE_UNQNAME=orcl
ORACLE_OWNER=oracle
# Path
DB_START="${ORACLE_HOME}/bin/dbstart ${ORACLE_HOME}"
EM_START="${ORACLE_HOME}/bin/emctl start dbconsole"
DB_STOP="${ORACLE_HOME}/bin/dbshut ${ORACLE_HOME}"
EM_STOP="${ORACLE_HOME}/bin/emctl stop dbconsole"
prog=dbora
RETVAL=0
case "$1" in
   start)
      su - ${ORACLE_OWNER} -c "${DB_START}"
      su - ${ORACLE_OWNER} -c "${EM_START}"
      ;;
   stop)
      su - ${ORACLE_OWNER} -c "${EM_STOP}"
      su - ${ORACLE_OWNER} -c "${DB_STOP}"
      ;;
   restart|reload)
      $0 stop
      $0 start
      ;;
   *)
      echo $"Usage: ${prog} {start|stop|restart|reload}"
      exit 1
esac

exit $RETVAL

[root@cent5-64b-40 ~]# 

[oracle@cent5-64b-40 ~]$ set | grep ORACLE
ORACLE_BASE=/opt/oracle/app
ORACLE_HOME=/opt/oracle/app/product/11.2.0/dbhome_1
ORACLE_HOME_LISTNER=/opt/oracle/app/product/11.2.0/dbhome_1
ORACLE_OWNER=oracle
ORACLE_UNQNAME=orcl
[oracle@cent5-64b-40 ~]$ 


[oracle@cent5-64b-40 ~]$ cat hira-conf.sql 
define_editor=vi
set echo off
set linesize 10000
set pagesize 0
set trimspool on
set feedback off
set colsep ','
[oracle@cent5-64b-40 ~]$ 

として、


以下、スタートアップの時のコンソールの見え方

[root@cent5-64b-40 ~]# /etc/init.d/dbora start
Processing Database instance "orcl": log file /opt/oracle/app/product/11.2.0/dbhome_1/startup.log
Oracle Enterprise Manager 11g Database Control Release 11.2.0.1.0 
Copyright (c) 1996, 2009 Oracle Corporation.  All rights reserved.
https://cent5-64b-40:1158/em/console/aboutApplication
Starting Oracle Enterprise Manager 11g Database Control ............. started. 
------------------------------------------------------------------
Logs are generated in directory /opt/oracle/app/product/11.2.0/dbhome_1/cent5-64b-40_orcl/sysman/log 
[root@cent5-64b-40 ~]# 
[root@cent5-64b-40 ~]# /etc/init.d/dbora stop
Oracle Enterprise Manager 11g Database Control Release 11.2.0.1.0 
Copyright (c) 1996, 2009 Oracle Corporation.  All rights reserved.
https://cent5-64b-40:1158/em/console/aboutApplication
Stopping Oracle Enterprise Manager 11g Database Control ... 
 ...  Stopped. 
Processing Database instance "orcl": log file /opt/oracle/app/product/11.2.0/dbhome_1/shutdown.log
[root@cent5-64b-40 ~]# 

sysdbaではいろうとすると

[oracle@cent5-64b-40 ~]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.1.0 Production on 土 8月 25 09:00:04 2012

Copyright (c) 1982, 2009, Oracle.  All rights reserved.

ERROR:
ORA-12162: TNS: 指定されたNetサービス名は正しくありません。

と怒らるので ORACLE_SID環境変数を追加

ユーザの追加とgrant

SQL> create user orcl
  2  profile default
  3  identified by xxxx
  4  default tablespace users
  5  temporary tablespace temp
  6  account unlock 
  7  ;

ユーザーが作成されました。

SQL> 

SQL> grant connect to orcl;

権限付与が成功しました。

SQL> grant dba to orcl;

権限付与が成功しました。

SQL> 

これでorclにて入れるようになるし、なんでもできる

実験機としてたちあげるならば、
郵便番号データをDBにいれて実験するのがよろしいかと
http://d.hatena.ne.jp/toshi_hirasawa/20120816/1345122460