বৃহস্পতিবার, ২৬ মে, ২০২২
Duplicate a Database Using RMAN in Oracle Database 12c Release 2
বুধবার, ২৫ মে, ২০২২
Data import using db link
create public database link link_orclconnect to scottidentified by ***usint 'local';grant imp_full_database,exp_full_database to scott;impdp network_link=link_orclimpdp network_link=link_orcl directory=test logfile=test.logimpdp network_link=link_orcl directory=test logfile=test.log tables=dept
মঙ্গলবার, ২৪ মে, ২০২২
Data Guard
Primary database
startup mount; alter database archivelog; archive log list; show parameter db_recovery_file alter system set db_recovery_file_dest='/u01/app/oracle/fast_recovery_area' alter system set db_recovery_file_dest_size=5g scope=both; alter database force logging; alter system switch logfile; alter database add standby logfile '/u01/app/oracle/oradata/orcl/sbylog4.log' size 200M; alter database add standby logfile '/u01/app/oracle/oradata/orcl/sbylog5.log' size 200M; alter database add standby logfile '/u01/app/oracle/oradata/orcl/sbylog6.log' size 200M; alter database add standby logfile '/u01/app/oracle/oradata/orcl/sbylog7.log' size 200M; alter system set log_archive_dest_1='LOCATION=USE_DB_RECOVERY_FILE_DEST valid for=(all_logfiles,all_roles) db_unique_name=orcl' scope=both alter system set log_archive_dest_2='service=stand async valid_for=(online_logfile,primary_role) db_unique_name=stand' scope=both; alter system set standby_file_management=auto; alter system set log_archive_config='DG_CONFIG=(orcl,stand)'; alter system set fal_client=orcl; alter system set fal_server=stand; scp orapworcl oracle@192.168.1.81:/u01/app/oracle/product/12.2.0/db_1/dbs/orapwstand create pfile='/home/oracle/initstand.ora' from spfile;
Demo pfile stand.__data_transfer_cache_size=0 stand.__db_cache_size=637534208 stand.__inmemory_ext_roarea=0 stand.__inmemory_ext_rwarea=0 stand.__java_pool_size=16777216 stand.__large_pool_size=33554432 stand.__oracle_base='/u01/app/oracle'#ORACLE_BASE set from environment stand.__pga_aggregate_target=671088640 stand.__sga_target=989855744 stand.__shared_io_pool_size=50331648 stand.__shared_pool_size=234881024 stand.__streams_pool_size=0 *.audit_file_dest='/u01/app/oracle/admin/orcl/adump' *.audit_trail='db' *.compatible='12.2.0' *.control_files='/u01/app/oracle/oradata/stand/control01.ctl','/u01/app/oracle/oradata/stand/control02.ctl' *.db_block_size=8192 *.db_name='orcl' *.db_unique_name='stand' *.db_recovery_file_dest_size=5368709120 *.db_recovery_file_dest='/u01/app/oracle/fast_recovery_area' *.diagnostic_dest='/u01/app/oracle' *.dispatchers='(PROTOCOL=TCP) (SERVICE=orclXDB)' *.fal_client='STAND' *.fal_server='ORCL' *.log_archive_config='DG_CONFIG=(orcl,stand)' *.log_archive_dest_1='location=USE_DB_RECOVERY_FILE_DEST valid_for=(all_logfiles,all_roles) db_unique_name=stand' *.log_archive_dest_2='service=orcl async valid_for=(online_logfile,primary_role) db_unique_name=orcl' *.db_file_name_convert='/u01/app/oracle/oradata/orcl','/u01/app/oracle/oradata/stand' *.log_file_name_convert='/u01/app/oracle/oradata/orcl','/u01/app/oracle/oradata/stand' *.memory_target=1570m *.nls_language='AMERICAN' *.nls_territory='AMERICA' *.open_cursors=300 *.processes=320 *.remote_login_passwordfile='EXCLUSIVE' *.standby_file_management='AUTO' *.undo_tablespace='UNDOTBS1'
Directory standby ----------------- /u01/app/oracle/fast_recovery_area/stand /u01/app/oracle/admin/orcl/adump /u01/app/oracle/oradata/stand
startup pfile=initstand.ora nomount
rman target sys/sys123@orcl auxiliary sys/sys123@stand
duplicate target database for standby from active database dorecover NOFILENAMECHECK;
ALTER DATABASE RECOVER MANAGED STANDBY DATABASE disconnect from session;
select open_mode, controlfile_type from v$database;
alter database open read only;
alter database recover managed standby database cancel;
select * from v$logfile;
Performance mode change step
==============================================================
In Primary
alter system set log_archive_dest_2='service=stand affirm lgwr sync valid_for=(online_logfiles,primary_role) db_unique_name=stand' scope=both;
SHUTDOWN IMMEDIATE;
STARTUP MOUNT;
ALTER DATABASE SET STANDBY DATABASE TO MAXIMIZE AVAILABILITY;
ALTER DATABASE SET STANDBY DATABASE TO MAXIMIZE PROTECTION;
alter database open;
In Standby
alter system set log_archive_dest_2='service=orcl affirm lgwr sync valid_for=(online_logfiles,primary_role) db_unique_name=orcl' scope=both;
SELECT PROTECTION_MODE, PROTECTION_LEVEL FROM V$DATABASE;
Performance Check
select SOURCE_DBID,name,value,unit,TIME_COMPUTED,DATUM_TIME,con_id from v$dataguard_stats
select thread#,max(sequence#) from v$archived_log group by thread#;
select thread#, max(sequence#) "Last Primary Seq Generated"
from v$archived_log val, v$database vdb
where val.resetlogs_change# = vdb.resetlogs_change#
group by thread# order by 1;
select thread#, max(sequence#) "Last Standby Seq Applied"
from v$archived_log val, v$database vdb
where val.resetlogs_change# = vdb.resetlogs_change#
and val.applied='YES'
group by thread# order by 1;
select * from v$dataguard_status;
SELECT a.resetlogs_id, DECODE (a.thread#, 1, 'node1', 2, 'node2') HOST, b.last_seq prmy_last_file,
a.applied_seq stdby_last_file, CASE WHEN b.last_seq - a.applied_seq > 2 THEN '=>' ELSE to_char(b.last_seq - a.applied_seq) END archive_difference, TO_CHAR (a.latest_apply_time, 'dd/mm/yyyy hh24:mi:ss') stdby_latest_time
FROM (SELECT resetlogs_id, thread#, MAX (sequence#) applied_seq, MAX (next_time) latest_apply_time
FROM v$archived_log
WHERE applied = 'YES'
GROUP BY resetlogs_id, thread#) a,
(SELECT resetlogs_id, thread#, MAX (sequence#) last_seq
FROM v$archived_log
GROUP BY resetlogs_id, thread#) b
WHERE a.thread# = b.thread#
ORDER BY a.thread#;
select max(sequence#),thread#, applied from v$archived_log group by thread#, applied;
Errors in file /u01/app/oracle/diag/rdbms/stand/orcl/trace/orcl_ora_5913.trc:
ORA-00313: open failed for members of log group 7 of thread 0
ORA-00312: online log 7 thread 0: '/u01/app/oracle/oradata/orcl/sbylog7.log'
ORA-27037: unable to obtain file status
alter system set standby_file_management=manual;
ALTER DATABASE RECOVER MANAGED STANDBY DATABASE CANCEL;
alter database clear logfile group 4;
alter database clear logfile group 5;
alter database clear logfile group 6;
alter database clear logfile group 7;
alter system set standby_file_management=auto;
ALTER DATABASE RECOVER MANAGED STANDBY DATABASE disconnect from session;
Switchover Operation Procedure:
Status cheque: select name,open_mode,database_role from v$database;select switchover_status from v$database;
On primary :
alter database commit to switchover to standby;shutdown immediate
startup nomount
alter database mount standby database
alter database recover managed standby database disconnect from session;
On standby :
alter database commit to switchover to primary;
বুধবার, ২৭ এপ্রিল, ২০২২
DML Checking in view
select table_name,column_name,updatable,insertable,deletable from
USER_UPDATABLE_COLUMNS where table_name='MM_ITEM_INFO_V'
CREATE VIEW EMP_SAL AS SELECT EMPNO, ENAME ,SAL FROM EMP WHERE SAL < 2000 WITH CHECK OPTION;
শুক্রবার, ১১ মার্চ, ২০২২
Report server create 12c
./wlst.sh
wlst> connect('weblogic','weblogic123', 'http://localhost:7001')
createReportsToolsInstance(instanceName='reptools1',machine='AdminServerMachine')
vi
/u02/app/middleware/user_projects/domains/DEV_domain/config/fmwconfig/servers/WLS_REPORTS1/applications/reports_12.2.1/configuration/rwservlet.properties
<server>rep_wls_reports_alamin</server>
<singlesignon>yes</singlesignon>
<inprocess>yes</inprocess>
<webcommandaccess>L2</webcommandaccess>
createReportsServerInstance(instanceName='my_repsrv',machine=’AdminServerMachine')
vi /u02/app/middleware/user_projects/domains/DEV_domain/config/fmwconfig/components/ReportsServerComponent/my_repsrv/rwserver.conf
Change: <!--job jobType="report" engineId="rwEng" securityId="rwJaznSec"/-->
To: <job jobType="report" engineId="rwEng"/>
cd /u02/app/middleware/user_projects/domains/base_domain/bin
./startComponent.sh my_repsrv storeUserConfig
export DOMAIN_HOME=$ORACLE_BASE/config/domains/base_domain
mkdir -p $DOMAIN_HOME/servers/AdminServer/security
echo "username=weblogic" > $DOMAIN_HOME/servers/AdminServer/security/boot.properties
echo "password=weblogic123" >> $DOMAIN_HOME/servers/AdminServer/security/boot.properties
mkdir -p $DOMAIN_HOME/servers/WLS_FORMS/security
cp $DOMAIN_HOME/servers/AdminServer/security/boot.properties $DOMAIN_HOME/servers/WLS_FORMS/security/boot.properties
mkdir -p $DOMAIN_HOME/servers/WLS_REPORTS/security
cp $DOMAIN_HOME/servers/AdminServer/security/boot.properties $DOMAIN_HOME/servers/WLS_REPORTS/security/boot.properties
Standalone Report server 11g
./opmnctl createcomponent -adminUsername weblogic -adminHost alamin -adminPort 7004 -oracleHome /u01/app/oracle/middleware/Oracle_FRHome1
-oracleInstance /u01/app/oracle/middleware/asinst_1 -instanceName asinst_1 -componentName rep_svr -componentType ReportsServerComponent
./opmnctl startproc ias-component=rep_svr
export MW_HOME=/u01/app/oracle/middleware
export WLS_HOME=$MW_HOME/wlserver_10.3
export WL_HOME=$WLS_HOME
export ORACLE_HOME=$MW_HOME/Oracle_FRHome1
export ORACLE_INSTANCE=$MW_HOME/asinst_1
export FR_HOME=$ORACLE_HOME
export FR_INST=$ORACLE_INSTANCE
export DOMAIN_HOME=$MW_HOME/user_projects/domains/ClassicDomain
export JAVA_HOME=/u01/app/oracle/jdk1.7.0_80
export PATH=$ORACLE_INSTANCE/bin:$ORACLE_HOME/bin:$JAVA_HOME/bin:$PATH:/usr/lib64
# Forms compilation
export PATH=.:$FR_HOME/bin:$FR_HOME/forms/mesg:$PATH:/usr/lib64
#export LD_LIBRARY_PATH=$FR_HOME/jdk/jre/lib/amd64/native_threads:$FR_HOME/jdk/jre/lib/amd64:$FR_HOME/lib:$FR_HOME/jdk/jre/lib/amd64/server
export LD_LIBRARY_PATH=/usr/lib/x86_64-linux-gnu/:$LD_LIBRARY_PATH:/usr/lib64
export FORMS_BUILDER_CLASSPATH=$FR_HOME/jlib/
export FORMS_PATH=/u01/app/oracle/middleware/Oracle_FRHome1/forms
export REPORTS_PATH=/u01/app/oracle/middleware/Oracle_FRHome1/reports
export TWO_TASK=ORCL
export TNS_ADMIN=$FR_HOME/network/admin
export TERM=vt220
export ORACLE_TERM=$TERM
# Reports server: Adjust as required to allow forms to get the reports server name
# using "tool_env.getvar('REPORTS_SERVER_NAME', v_rep_server);"
#export REPORTS_SERVER_NAME=rep_wls_reports_ol6-forms_asinst_1