数据库相关帮助命令

Oracle
======================================================Linux============================================================
sqlplus /nolog
SQL> conn system/system
ERROR:
ORA-01017: invalid username/password; logon denied
在SQL*Plus中执行如下命令
conn/as sysdba(操作系统认证登录)
alter user system identified by system(回车后用户system的密码为system);

alter user soctt account lock; // 把 scott用户锁定
alter user scott account unlock;//把scott用户解锁
alter user scott identified by  scott //修改scott用户密码为 scott,scott用户默认密码为 tiger

======================================================

oracle 服务启动
su - oracle
ll
env
sqlplus /nolog
connect / as sysdba
startup
quit
oracle 服务启动
lsnrctl start
lsnrctl status

======================================================

--删除用户&表空间(通信录)
DROP USER contacts cascade;
DROP TABLESPACE contacts INCLUDING CONTENTS AND DATAFILES;

--建立用户&表空间
CREATE USER contacts IDENTIFIED BY contacts;
CREATE TABLESPACE contacts datafile '/opt/database/data_files/pjdb/contacts.dbf' SIZE 10M;

--用户授权
GRANT dba TO contacts;
GRANT connect TO contacts;
GRANT resource TO contacts;
ALTER USER contacts quota unlimited ON contacts;

======================================================
su -oracle
sqlplus /nolog

Linux 下 oracle数据库导入命令(/opt/database/flash_recovery_area/backup)
impdp
calendar/calendar@xxDB DIRECTORY=backup DUMPFILE=lzw.dmp
imp
contacts/contacts@xxDB file=lzw.dmp full=y

======================================================

Linux 下 oracle数据库导出命令
expdp
contacts/contacts@xxdb DIRECTORY=backup DUMPFILE=lzw.dmp
exp
contacts/contacts@ddzdb DIRECTORY=backup DUMPFILE=lzw.dmp                  
expdp
calendar/calendar@xxDB DIRECTORY=backup DUMPFILE=lzw.dmp SCHEMAS=calendar logfile=lzw.log
exp  
calendar/calendar@xxDB DIRECTORY=backup DUMPFILE=lzw.dmp SCHEMAS=calendar logfile=lzwr.log
expdp
contacts/contacts@lzwdb DIRECTORY=backup DUMPFILE=lzw.dmp SCHEMAS=contacts logfile=lzw.log

======================================================
11g导入成10g linux环境导入到windows环境
D:\oracle\product\10.2.0\admin\orcl\dpdump\lzw.dmp
expdp
contacts/contacts@db24mim DIRECTORY=backup DUMPFILE=lzw.dmp version= 10.2.0.1.0  
把文件放到D:\oracle\product\10.2.0\admin\orcl\dpdump\lzw.dmp
C:\Documents and Settings\Administrator>impdp
contacts/contacts@orcl DUMPFILE=lzw.dmp TABLE_EXISTS_ACTION=replace

C:\Documents and Settings\Administrator>expdp contacts/contacts@orcl DUMPFILE=lzw.dmp 导出

====================================windows==========================================

创建表空间
create tablespace calendar datafile '/app/oracle/oradata/saas/calendar.dbf' size 50m autoextend on next 5m [maxsize 20m];

创建用户
create user username identified by capinfocalendar
default tablespace calendar
temporary tablespace temp;
grant connect,resource to username;

mysql
===========================================windows==========================================

导出
mysqldump -uroot -p123456 calendar>c:/calendar1204.sql
导入
mysql> use calendar
Database changed
mysql> source f:/calendar12014.sql
===========================================Linux============================================

Linux (/usr/local/mysql/bin)
导出
mysql
mysql/bin目录下
mysqldump -uroot -p123456 calendar>calendar1204.sql
导入

======================================================
mysql> use calendar
Database changed
mysql> source calendar12014.sql

 

 

 

你可能感兴趣的:(数据库相关帮助命令)