Oracle
--创建临时表空间
create temporary tablespace SJGL_TEMP tempfile 'SJGL_TEMP.DBF' size 500M autoextend on;
--创建表空间
create tablespace SJGL logging datafile 'SJGL.DBF' size 500M autoextend on;
--创建用户并指定表空间 (建议将密码修改一下,以免导入数据的时候别人连上上来了)
create user sjgl identified by sjgl default tablespace SJGL temporary tablespace SJGL_TEMP profile default;
--给用户授予系统权限
grant connect,resource,dba to sjgl ;
grant unlimited tablespace to sjgl ;
--设置用户密码永不过期
ALTER PROFILE DEFAULT LIMIT PASSWORD_LIFE_TIME UNLIMITED;
创建序列
Create sequence seqEmp increment by 1 start with 1 maxvalue 3 minvalue 1
alter user 用户名 identified by 新密码;
linux 导入数据库 su - oracle 然后imp
orapwd file=E:\app\THINK\product\11.2.0\dbhome_1\database\pwdctcsys.ora password=tiger
导入导出数据库
dmp文件
imp system/orcl@10.119.119.114:1521/orcl file=D:\20170619.dmp fromuser=sjgl touser=sjgl
exp ctc/ctc@192.168.2.28:1521/orcl file=F:\ctc201601214.dmp INDEXES=n STATISTICS=none TRIGGERS=n
impdp szxf/szxf DIRECTORY=DUMP_DIR DUMPFILE=full20170331.dmp schemas=szxf
查子类(PRIOR,oracle特有)
select jgmc, LEVEL
from TEST_ORG t WHERE LEVEL>3
START WITH id ='eb09df352cda4902b24c54dd2b2ce656'
CONNECT BY PRIOR T.id = t.ssxfjgdm ORDER BY LEVEL
查询数据库备注
--查看表的commentselect TABLE_name, COMMENTS
from all_tab_comments where OWNER='CTC' ;
--查看列的comment
select * from all_col_comments where table_name=upper('bayonet_carstream') ;
MySQL
mysql增加一天日期update location set created_date = DATE_ADD(created_date,INTERVAL 1 DAY)