Private Synonym or Public Synonym 사용중인가?
tibero6 client 세팅
# User specific environment and startup programs
### Tibero RDBMS 6 ENV ###
export TB_HOME=/home/tibero/tibero6
export TB_SID=ARK01DB
export TB_PROF_DIR=$TB_HOME/bin/prof
export PATH=.:$TB_HOME/bin:$TB_HOME/client/bin:$JAVA_HOME:$PATH
export LD_LIBRARY_PATH=$TB_HOME/lib:$TB_HOME/client/lib:$LD_LIBRARY_PATH
######## TIBERO alias ########
alias tbhome='cd $TB_HOME'
alias tbbin='cd $TB_HOME/bin'
alias tblog='cd $TB_HOME/instance/$TB_SID/log'
alias tbcfg='cd $TB_HOME/config'
alias tbcfgv='vi $TB_HOME/config/$TB_SID.tip'
alias tbcli='cd ${TB_HOME}/client/config'
alias tbcliv='vi ${TB_HOME}/client/config/tbdsn.tbr'
alias tbi='cd ~/tbinary'
alias tm='cd ~/tbinary/monitor;monitor;cd -'
alias tbdata='cd /data/tbdata'
================================================
tibero6 세팅
1.yum install -y ncurses*
2. ln -s /usr/lib64/libncurses.so.6 /usr/lib64/libncurses.so.5 <== 링크 생성
3. tbdsn.tbr
#-----------------------------------------------
# C:\TmaxData\tibero6\client\config\tbdsn.tbr
# Network Configuration File.
# Generated by cohttp://m.m.wizard.dsn.InstanceDsnGenerator at Mon Jul 16 10:00:40 KST 2018
tibero=(
(INSTANCE=(HOST=192.168.52.131)
(PORT=8629)
(DB_NAME=tibero06)
)
)
===================================
============================================
1. tip파일에 hidden parameter 추가 후 저장
-> tibero 계정 접속시 .passwd파일을 이용하지 않는 파라미터(.passwd : 계정 패스워드 정보가 담긴 파일)
>> tip파일 경로: %TB_HOME%/config/%TB_SID%.tip
_MOUNT_MODE_WITHOUT_PASSWD_FILE=Y
2. tibero 종료
tbdown
3. tibero data폴더 내 .passwd파일 삭제 또는 rename
4. tibero mount 모드 가동
tbboot mount
5. sys계정에 무작위 비밀번호를 입력해 접속
-> 1번의 파라미터입력과 3번작업으로 .passwd에 등록된 비밀번호를 사용하지 않고 DB접속 가능
tbsql sys/무작위문자 (ex. tbsql sys/qwer)
6. tibero normal모드 기동
alter database open;
7. sys계정 비밀번호 변경
alter user sys identified by tibero;
ARK01DB : db 명
tbsql sys/song@tibero
tbsql scott/tiger@tibero
/var/lib/edb/data
/home/tibero/tibero6//bin
. ~/.bash_profile
alias tbhome='cd $TB_HOME'
alias tbbin='cd $TB_HOME/bin'
alias tblog='cd $TB_HOME/instance/$TB_SID/log'
alias tbcfg='cd $TB_HOME/config'
chown -R
### Tibero RDBMS 6 ENV ###
export TB_HOME=/home/tibero/tibero6
export TB_SID=ARK01DB
export TB_PROF_DIR=$TB_HOME/bin/prof
export PATH=.:$TB_HOME/bin:$TB_HOME/client/bin:$JAVA_HOME:$PATH
export LD_LIBRARY_PATH=$TB_HOME/lib:$TB_HOME/client/lib:$LD_LIBRARY_PATH
######## TIBERO alias ########
alias tbhome='cd $TB_HOME'
alias tbbin='cd $TB_HOME/bin'
alias tblog='cd $TB_HOME/instance/$TB_SID/log'
alias tbcfg='cd $TB_HOME/config'
alias tbcfgv='vi $TB_HOME/config/$TB_SID.tip'
alias tbcli='cd ${TB_HOME}/client/config'
alias tbcliv='vi ${TB_HOME}/client/config/tbdsn.tbr'
alias tbi='cd ~/tbinary'
alias tm='cd ~/tbinary/monitor;monitor;cd -'
alias tbdata='cd /data/tbdata'
=======================tibero 메뉴얼
tbsql scott/tiger@tibero
loadfile dept
select * from dept ;
loadfile bones
select * from BONUS ;
grant select_catalog_role to scott;
select to_char(sys.dbms_metadata.get_ddl('TABLE','dept','scott')) from dual
select sys.dbms_metadata.get_ddl('TABLE','dept','sys'))
from user_tables
select to_char(dbms_metadata.get_ddl('TABLE','EMP','SYS')) from dual;
select dbms_metadata.get_ddl('TABLE','TABLE_NAME','OWNER') from dba_tables where owner='SCOTT' AND ROWNUM=1
SELECT TABLE_NAME,OWNER
from dba_tables
where owner='SCOTT'
AND ROWNUM=1
loadfile emp
select * from emp ;
=========================edb loder
edbldr -d scottdb -p 5434 userid=scott/tiger
edbldr -d dbname -p port userid={user[/passwd]|/} control=control_file_path
log=log_file_path bad=bad_file_path parfile=param_file_path skip=skip_count
skip_index_maintenance={true|false} direct={true|false} errors =
error_count
select table_name from user_tables;
ALTER PROCEDURE SYS.dbms_metadata COMPILE;
ALTER PACKAGE SYS.dbms_metadata COMPILE;
SELECT *
From DBA_objects where status <>‘VALID’
and object_type IN (‘VIEW’, ’SYNONYM’, ‘PROCEDURE’, ’FUNCTION’,‘PACKAGE’,’TRIGGER’) ;
ALTER PACKAGE dbms_metadata COMPILE;
SELECT * FROM user_objects where status <> ‘VALID'
select sys.dbms_metadata.get_ddl('TABLE','dept','sys') from dual;
grant select_catalog_role to scott
select to_char(dbms_metadata.get_ddl('TABLE','dept','scott')) from dual
SELECT DBMS_METADATA.GET_DDL('TABLE','DEPT') FROM DUAL;
tbexport USERNAME=sys PASSWORD=song IP=192.168.52.131 sid=ARK01DB PORT=8629 LOG=exp_data_user.log USER=scott SCRIPT=y
enterprisedb 계정을 접속
cd /var/lib/edb/data
loadfile dept
select * from dept ;
tbsql scott/tiger@tibero
spool /var/lib/edb/data/test.sql
select 'loadfile '|| tname||';' from tab
union all
select 'select * from '||tname||';' from tab;
spool off
@ /var/lib/edb/data/test.sql
/var/lib/edb/data
select 'loadfile '|| tname||';' from tab
union all
select 'select * from '||tname||';' from tab;
tbsql -s <<EOF
conn scott/tiger@tibero
set echo off;
set term off;
set head off;
set feedback off;
set termout off ;
set time off;
set line 200 ;
spool /var/lib/edb/data/test.sql
select name from (
select tname , 'loadfile '|| tname||';' as name from tab
union all
select tname,'select * from '||tname||';' as name from tab)
order by tname
spool off
@/var/lib/edb/data/test.sql
EOF
edbldr -d scottdb -p 5444 -h localhost userid=scott/tiger control=/var/lib/edb/data/EMP.ctl log=/var/lib/edb/data/dept.log bad=/var/lib/edb/data/baddept.log
host all all 192.168.52.165/24 md5
192.168.52.165/24
CREATE OR REPLACE PUBLIC SYNONYM EMP FOR scottdb.EMP;
insert into scott.EMP
values(
7698, 'BLAKE', 'MANAGER', 7839,
to_date('1-5-1981','dd-mm-yyyy'),
2850, null, 30
);
================================= edb db 구성
=============
db 생성 user ====
edb=# create user test;
db 생성
edb=# CREATE DATABASE scottdb OWNER test ;
alter user test identified by test;
=====>create user testuser with password 'qhdks123';
[root@localhost home]# mkdir pg_data
[root@localhost home]# chown -R enterprisedb /home/pg_data
create tablespace test_ts owner test location '/home/pg_data/';
postgres-# \c testdb testuser
===> db 소유자로 접속
psql -U test -d scottdb -h localhost -p 5444
=============
=====tmzlak 생성시 주의
stdb=> create schema scott authorization test;
set search_path to "test",testdb; <== [user명 db 명 ]
create table scott.test (test varchar2(10));
CREATE TABLE scott.BONUS (
ENAME VARCHAR(10 ),
JOB VARCHAR(9 ),
SAL NUMBER,
COMM NUMBER
) ;
CREATE TABLE scott.DEPT (
DEPTNO NUMBER(2),
DNAME VARCHAR(14 ),
LOC VARCHAR(13 ));
CREATE TABLE scott.EMP (
EMPNO NUMBER(4),
ENAME VARCHAR(10 ),
JOB VARCHAR(9 ),
MGR NUMBER(4),
HIREDATE DATE,
SAL NUMBER(7,2),
COMM NUMBER(7,2),
DEPTNO NUMBER(2));
create synonym BONUS for scott.BONUS;
create synonym DEPT for scott.DEPT;
create synonym EMP for scott.EMP;
===================imp 작업
edbldr -d scottdb -p 5444 -h localhost userid=test/test control=/var/lib/edb/data/EMP.ctl log=/var/lib/edb/data/dept.log bad=/var/lib/edb/data/baddept.log
edbldr -d scottdb -p 5444 -h localhost userid=test/test control=/var/lib/edb/data/DEPT.ctl log=/var/lib/edb/data/DEPT.log bad=/var/lib/edb/data/badDEPT.log
psql -U test -d scottdb -h localhost -p 5444