#进入Oracle容器
docker exec -it docker_id bash
#切换到Oracle用户
su oracle
#连接Oracle数据库
rlwrap sqlplus sys/oracle as sysdba
#切换到用户dts_test
conn dts_test
#输入密码
my_pw
#查询数据库
select * from v$database
#查询数据
select * from schema.table
#插入数据
insert into dts_user.orc_test (seq_id,id,uuid,app_id,create_time,is_locked,is_sent) values (222,6,0,222,20211221,222,1)
-- 查询用户
SELECT username FROM dba_users;
-- 创建用户
CREATE USER DTS_BUG_TEST IDENTIFIED BY password;
-- 删除用户
DROP USER DTS_USER CASCADE;
#清除表内容
delete DTS_USER.DTS_SINK
#修改字段类型
alter table DTS_USER.DTS_COVER_SINK modify DATETIME NULL;
#添加一列
ALTER TABLE DTS_TEST.DTS_SOURCE_UPDATE_DDL
ADD bgint2_info number;
#设置命令自动提交
set autocommit on;
#查询时区
select to_char(sysdate,'yyyy-MM-dd HH24:mi:ss') from dual;
修改容器时区:
ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
echo "Asia/Shanghai" > /etc/timezone
清除日志
(清除日志之后,需要更新点位,重启oracle)
在目录:/data00/datasource/util
执行:sudo sh del_orc_archivelogs.sh
# 点位查询
select CURRENT_SCN from v$database;
select dbms_flashback.get_system_change_number from dual;
#查询数据库连接方式
select instance_name from V$instance;
Oracle 常用命令
最新推荐文章于 2024-11-04 16:01:37 发布