⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 工程维护.sql

📁 本人在工程上收集的比较常用的oracle sql语句 有问题请发email:leafboyman@tom.com
💻 SQL
字号:
--查看索引
select index_name from all_indexes where TABLE_NAME='HISTORY';
select index_name from all_indexes where TABLE_NAME=upper('&表名');

--查看表的分区
select partition_name,TABLESPACE_NAME from user_extents WHERE SEGMENT_NAME='HISTORY';

SELECT partition_name,TABLESPACE_NAME FROM user_extents  
	WHERE SEGMENT_NAME='HISTORY' and partition_name in 
        (select min(partition_name) from user_extents WHERE SEGMENT_NAME='HISTORY');

select PARTITION_NAME,TABLESPACE_NAME from all_tab_partitions where TABLE_NAME=upper('history') order by PARTITION_NAME;

--查看用户
select * from all_users;

--查看用户所有的表
conn 用户
select * from tab;

--把经常用的表放到cache里
alter table no cache;

--查看表使用的表空间
select table_name,tablespace_name from all_all_tables;
select table_name,tablespace_name from all_all_tables where tablespace_name=upper('&表空间名');
select table_name,tablespace_name from all_all_tables where table_name=upper('&表名');
--查看哪些表使用了分区
select table_name,tablespace_name from all_all_tables where tablespace_name is null and owner='DYT';

select index_name from all_indexes where TABLE_NAME=upper('test');
select PARTITION_NAME,TABLESPACE_NAME  from all_tab_partitions where TABLE_NAME=upper('test');
select PARTITION_NAME,TABLESPACE_NAME from all_ind_partitions where index_NAME=upper('testidx');


--如何在字符串里加回车?
select Welcome to visit ||chr(10)|| www.CSDN.NET from dual ;

--如何改变WIN中SQL*Plus启动选项?

  SQL*PLUS自身的选项设置我们可以在$ORACLE_HOME/sqlplus/admin/glogin.sql中设置。

--怎样修改oracel数据库的默认日期?

  alter session set nls_date_format= yyyymmddhh24miss ;

  OR

  可以在init.ora中加上一行 

  nls_date_format= yyyymmddhh24miss 


⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -