Oracle 一些操作

时间:2022-01-31 01:37:20

Achivelog
============================

alter system set db_recovery_file_dest='F:\ORACLE\recovery_area' scope=both;
alter system set db_recovery_file_dest_size=100G scope=both;

 

Select big table

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

select table_name,blocks*8192/1024/1024 size_m from user_tables order by size_m desc nulls last;

 

Create DB Link

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

create public database link ORCL_AA
connect to username identified by "1234"
using 'ORCL_CC';

 

Set Password Unlimited

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

SELECT username, PROFILE FROM dba_users
where username in('SYS','SYSTEM','MGMT_VIEW','WDM_APP','SYSMAN','DBSNMP');

SELECT * FROM dba_profiles s
WHERE s.profile='DEFAULT' AND resource_name='PASSWORD_LIFE_TIME';

SELECT * FROM dba_profiles s
WHERE s.profile='MONITORING_PROFILE' AND resource_name='PASSWORD_LIFE_TIME';

ALTER PROFILE DEFAULT LIMIT PASSWORD_LIFE_TIME UNLIMITED;  
ALTER PROFILE MONITORING_PROFILE LIMIT PASSWORD_LIFE_TIME UNLIMITED; 

 

Alter Process

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

select count(*) from v$session
Select count(*) from v$session where status='ACTIVE'
show parameter processes
alter system set processes = 2000 scope = spfile;

 

Modify Log Path

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

-- 修改重做日志文件 路径
select * from V$logfile;

shutdown immediate;
-- 迁移文件 到相关目录
startup mount;

alter database rename file 'D:\APP\ORACLE\ORADATA\ORCL\REDO01.LOG' to 'F:\ORACLE\ORADATA\ORCL\REDO01.LOG';
alter database rename file 'D:\APP\ORACLE\ORADATA\ORCL\REDO02.LOG' to 'F:\ORACLE\ORADATA\ORCL\REDO02.LOG';
alter database rename file 'D:\APP\ORACLE\ORADATA\ORCL\REDO03.LOG' to 'F:\ORACLE\ORADATA\ORCL\REDO03.LOG';

alter database open;
-- ------------------------------------------------------------------------------------------------------------

-- 创建多路控制文件

select name from v$controlfile;

a)、shutdown immediate;

b)、startup nomount;

c)、
alter system set control_files =
'D:\APP\ORACLE\ORADATA\ORCL\CONTROL01.CTL',
'D:\APP\ORACLE\RECOVERY_AREA\ORCL\CONTROL02.CTL',
'F:\ORACLE\ORADATA\ORCL\CONTROL03.CTL'
scope = spfile;

d)、shutdown immediate;

e)、startup;

 

Temp Tablespace   常出现在Rman 异机恢复后的操作

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

create temporary tablespace temp_1
tempfile 'F:\ORACLE\ORADATA\ORCL\TEMP_01.DBF' size 1G reuse
autoextend on next 64M  maxsize UNLIMITED;

create temporary tablespace temp_2
tempfile 'F:\ORACLE\ORADATA\ORCL\TEMP_02.DBF' size 1G reuse
autoextend on next 64M  maxsize UNLIMITED;

alter tablespace temp_1 tablespace group temp_group;
alter tablespace temp_2 tablespace group temp_group;

alter database default temporary tablespace temp_group;

select * from dba_tablespace_groups;

alter tablespace temp1 tablespace group '';

alter database tempfile 'D:\APP\ORACLE\ORADATA\ORCL\TEMP01.DBF' drop;