SQL語句彙總

2021-07-14 04:31:52 字數 1261 閱讀 6634

檢視oracle伺服器端字符集

select * from nls_database_parameters;

檢視oracle客戶端字符集

select * from nls_instance_parameters;

全庫匯出資料

exp 使用者名稱/密碼@遠端的ip:埠/例項 file=存放的位置:\檔名稱.dmplog=c:\orabackup\export.log full = y

匯入資料

imp使用者名稱/密碼@遠端的ip:埠/例項 file=存放的位置:\檔名稱.dmplog=c:\orabackup\imp.log full=y

恢復oracle資料

一:通過scn號恢復

select current_scn from v$database;(返回當前版本號)

select * from tablename as of scn ***;(可繼續縮小scn)

flashback table tablename to scn ***;

二:通過時間戳恢復

select to_char(sysdate, 'yyyy-mm-dd hh24:mi:ss') from dual;

select * from tablename as of timestamp to_timestamp('2016-07-05 10:00:00','yyyy-mm-dd hh24:mi:ss');(可繼續縮小範圍)

flashback table tablename to timestamp to_timestamp('2016-07-05 10:00:00','yyyy-mm-dd hh24:mi:ss');

1. 複製表結構及其資料:

create table table_name_new as select * from table_name_old

2. 只複製表結構:

create table table_name_new as select * from table_name_old where 1=2;

create table table_name_new like table_name_old

新增資料:

insert into table_name_new select * from table_name_old

如果兩個表結構不一樣:

insert into table_name_new(column1,column2...) select column1,column2... from table_name_old

SQL語句彙總

sql語句彙總 一 資料庫 1.建立資料庫 create database name 2.檢視資料庫 show databases 3.選擇資料庫 use name 4.刪除資料庫庫 drop database name 二 表 1.建立表 create table name 屬性名 資料型別 屬性...

SQL語句彙總(一)

sql 是 structured query language 即 結構化查詢語言 的簡稱,它是用來管理關係型資料庫的。其包括 資料定義語言 ddl 資料查詢語言 dql 資料操作語言 dml 資料控制語言 dcl 建立資料庫 create database 資料庫名 資料庫名命名規則 複製表 cr...

SQL基本語句彙總

select lastname,firstname from persons 篩選表名為presons中欄位lastname fristname的資料 查詢和更新指令構成了 sql 的 dml 部分 select 從資料庫表中獲取資料 update 更新資料庫表中的資料 delete 從資料庫表中刪...