oracle 导入导出

 

sqlplus xnh/ccmsd123@//192.168.1.188:1531/PROD

 

sqlplus sys/manager@133 as sysdba

 

conn xnh/ccmsd123@133 as sysdba

 

--查询数据库现在的表空间

select tablespace_name, file_name, sum(bytes)/1024/1024 table_size from dba_data_files group by tablespace_name,file_name;

 

*******************************创建表空间*******************************

create tablespace TBS_DATA3 datafile '/data01/rdbms/prod/datafile/PROD_T_SIGNATURE.dbf' size 128M autoextend on next 64M maxsize 1024M;

create tablespace TBS_DATA1 datafile '/data01/rdbms/prod/datafile/PROD_T_NEWS.dbf' size 128M autoextend on next 64M maxsize 1024M;

 

--修改表空间

alter database datafile '/data01/rdbms/prod/datafile/prod_users_01.dbf' resize 128M;

 

创建用户

 

create user ccmsd identified by password default tablespace users temporary tablespace temp

 

分配dba权限

 

grant connect,resource,dba to ccmsd

 

 

导出

exp suplus/suplus@orcl file=d:\JNGD_suplus.dmp 

 

导入

 

imp mabxcc/mabxcc@voice file=d:\mabxcc.dmp full=y

 

imp finecom/finecom@voice file=d:\suplus.dmp full=y

 

 

C:\oracle\product\10.2.0\db_1\NETWORK\ADMIN

 

 

删除表空间

DROP TABLESPACE voice INCLUDING CONTENTS AND DATAFILES

查看所有用户

select * from all_users;

select * from dba_users;

删除用户表

drop  user  finecom  cascade   

 

imp XNH/ccmsd123@PROD file=c:\dmp\20100826xnh.dmp full=y

 

imp XNH/ccmsd123@prod file=c:\dmp\20100826xnh.dmp full=y

 

exp XNH/ccmsd123@188  file=c:\20100901xnh.dmp 

 

exp MYXNH/ccmsd123@PROD file=c:\myxnh_xnh.dmp log=c:\myxnh_xnh.log owner=(MYXNH,XNH)

 

exp MYXNH/ccmsd123@PROD direct=y  file=c:\oracle_backup\myxnh_xnh.dmp log=c:\myxnh_xnh.log owner=(MYXNH,XNH)

 

创建触发器

create or replace

TRIGGER "MYXNH".triger_transfer_id    before insert on t_transfer for each row    

begin        if :new.transfer_id is null then            select TRANSFER_SEQ.nextval into :new.transfer_id from dual;        

end if;    end;

 

create or replace

TRIGGER "MYXNH"."TRIGGER_JRNL_DETAL_ID" before insert on T_JRNL_DETAIL    for each row begin     if inserting then       if :NEW."ID" is null then        select JRNL_DETAL_SEQ.nextval into :NEW."ID" from dual;       end if;    end if; end;

 

create or replace

TRIGGER "MYXNH"."TRIGGER_FEE_INFO_ID" before insert  on  T_FEE_INFO    for each row begin     if inserting  then      

if :NEW."ID" is null then       select  FEE_INFO_SEQ.nextval into :NEW."ID" from dual;       end if;    end if; end;

 

 

 2. 导出一个完整数据库

  exp system/manager file=c:\bible_db log=c:\dible_db full=y

  3. 导出数据库定义而不导出数据

  exp system/manager file=bible_db log=dible_db full=y rows=n

  4. 导出一个或一组指定用户所属的全部表、索引和其他对象

  exp system/manager file=seapark log=seapark owner=seapark

  exp system/manager file=seapark log=seapark owner=(seapark,amy,amyc,harold)

 

 

 

 

 

 

1.设置页面显示总行数

 

show pagesize;   //首先查看目前的pagesize,默认是14

 

set pagesize 100; //将pagesize设置好100,则可以一次显示够多行记录了

 

2.设置行的宽度

 

show linesize;   //查看目前的linesize,默认是80

 

set linesize 100; //设置成100或者更宽都可以

 

sqlplus  system/manager@prod

 

查看连接客户端

 

 select t.MACHINE,t.OSUSER,t.PROGRAM,t.LOGON_TIME,t.USERNAME ,t.STATUS from v$session t  order by t.LOGON_TIME desc;

 

 select b.sql_text 

from v$session a,v$sqlarea b 

where a.sql_hashvalue=b.hash_value and a.sid=100

 

查看字符集

select * from nls_database_parameters

select * from V$NLS_PARAMETERS

 

Startup nomount;

  Alter database mount exclusive;

  Alter system enable restricted session;

  Alter system set job_queue_process=0;

  Alter database open;

  Alter database character set zhs16gbk;

 

 

/*********************查看修改字符集***********************************/

修改oracle 10g的字符集

Posted on 2006-10-16 in Oracle | 2 Comments ? Trackback URI

修改数据库字符集为:ZHS16GBK

查看服务器端字符集

SQL > select * from V$NLS_PARAMETERS

修改:

$sqlplus /nolog

SQL>conn / as sysdba?

若此时数据库服务器已启动,则先执行 SHUTDOWN IMMEDIATE 命

令关闭数据库服务器,然后执行以下命令:

SQL>shutdown immediate?

SQL>STARTUP MOUNT?

SQL>ALTER SYSTEM ENABLE RESTRICTED SESSION?

SQL>ALTER SYSTEM SET JOB_QUEUE_PROCESSES=0?

SQL>ALTER SYSTEM SET AQ_TM_PROCESSES=0?

SQL>ALTER DATABASE OPEN?

SQL>ALTER DATABASE CHARACTER SET ZHS16GBK?

*

ERROR at line 1:

ORA-12721: operation cannot execute when other sessions are active

若出现上面的错误,使用下面的办法进行修改,使用INTERNAL_USE可以跳过超集的检查:

SQL>ALTER DATABASE CHARACTER SET INTERNAL_USE ZHS16GBK?

SQL>SHUTDOWN IMMEDIATE?

SQL>STARTUP

 

 

 

 

 

 

 

select * from v$logfile;

 

select Tablespace_Name,Sum(bytes)/1024/1024 From Dba_Segments Group By Tabl espace_Name;

 

 

 

select * from v$log  可以看出日志文件的大小

你可能感兴趣的:(oracle,Oracle,SQL,C,C++,C#)