MERCADOS FINANCIEROS

viernes, 20 de diciembre de 2019

"Got minus one from a read call" error while trying to connect

"Got minus one from a read call" error while trying to connect 



Oracle relink command tips

Oracle Database Tips by Donald BurlesonMay 31, 2015

Question:  How foes the Oracle relink command work?  To relink a RAC rdbms, I executed $ORACLE_HOME/bin/relink command. Do I also have to run  ther makefile as well? 

cd $ORACLE_HOME/rdbms/lib
make -f ins_rdbms.mk rac_on oracle
Answer:  No, you do not need to run the make commands when you issue the Oracle relink command.  Remember that the  relink is a script and you can view the command file to see exactly what it is doing!
In UNIX and Linux, the DBA may occasionally find the need to relink the Oracle binaries. A relink is necessary whenever you install a new release or a patchset or when there is a patch or upgrade to the OS environment.
Sometimes a one-off patch for the OS or Oracle may require this. Not to mention that most Oracle major and minor version upgrades perform the exact same relink as a final part of the installation process. The relink process is fairly straightforward:
1. Identify at what granularity the operation is needed
2. Shut down those database components for that level
3. Issue the relink command for the desired granularity
4. Start up those database components for that level
The relink command syntax is as follows:
$ relink all | oracle | network | client | client_sharedlib | interMedia | precomp | utilities | oemagent | ldap
The larger the selected granularity; for example, all the more items that must be shut down and restarted for the relink, then the longer the relink process will take.Manual make commands
While the Oracle relink command will automatically run the make commands, you still may run them menually:
For executables: oracle, exp, imp, sqlldr, tkprof, mig, dbv, orapwd, rman, svrmgrl, ogms and ogmsctl
cd $ORACLE_HOME/rdbms/lib
make -f ins_rdbms.mk install


For sqlplus
cd $ORACLE_HOME/sqlplus/lib
make -f ins_sqlplus.mk install


For executables: dbsnmp, oemevent, oratclsh
cd $ORACLE_HOME/network/lib
make -f ins_oemagent.mk install


For executables: names, namesctl
cd $ORACLE_HOME/network/lib
make -f ins_names.mk install


For executables: osslogin, trcasst, trcroute, onrsd, tnsping
cd $ORACLE_HOME/network/lib
make -f ins_net_client.mk install


For executables: tnslsnr, lsnrctl
cd $ORACLE_HOME/network/lib
make -f ins_net_server.mk install
For more details on using the relink command, see MOSC Note: 131321.1 titled "Using Oracle relink on UNIX".


[oracle@sracsnc01 bin]$ relink all
writing relink log to: /u01/app/oracle/product/12.1.0.2/dbhome_1/install/relink.log
[oracle@sracsnc01 bin]$ pwd
/u01/app/oracle/product/12.1.0.2/dbhome_1/bin
[oracle@sracsnc01 bin]$



martes, 29 de octubre de 2019

TRIGGER AFTER LOGON

create or replace trigger trg_no_sys_logon
after logon
on database
declare
v_machine varchar2(30);
v_count number;
begin
select count(machine) into v_count
from host_machine_list
where SYS_CONTEXT('USERENV','HOST') = MACHINE;
If v_count = 0 then
for check_users in(select username
from v$session
where AUDSID = USERENV('SESSIONID')) loop
if upper(check_users.username) in ('SYSTEM')
then
insert into gdemo.dbas_aud3
(
LOGON_TIME
,TERMINAL
,SESSIONID
,INSTANCE
,ENTRYID
,ISDBA
,CURRENT_USER
,CURRENT_USERID
,SESSION_USER
,SESSION_USERID
,PROXY_USER
,PROXY_USERID
,DB_NAME
,HOST
,OS_USER
,EXTERNAL_NAME
,IP_ADDRESS
,NETWORK_PROTOCOL
,AUTHENTICATION_TYPE)
select
SYSDATE
,SYS_CONTEXT('USERENV','TERMINAL') TERMINAL
,SYS_CONTEXT('USERENV','SESSIONID') SESSIONID
,SYS_CONTEXT('USERENV','INSTANCE') INSTANCE
,SYS_CONTEXT('USERENV','ENTRYID') ENTRYID
,SYS_CONTEXT('USERENV','ISDBA') ISDBA
,SYS_CONTEXT('USERENV','CURRENT_USER') CURRENT_USER
,SYS_CONTEXT('USERENV','CURRENT_USERID') CURRENT_USERID
,SYS_CONTEXT('USERENV','SESSION_USER') SESSION_USER
,SYS_CONTEXT('USERENV','SESSION_USERID') SESSION_USERID
,SYS_CONTEXT('USERENV','PROXY_USER') PROXY_USER
,SYS_CONTEXT('USERENV','PROXY_USERID') PROXY_USERID
,SYS_CONTEXT('USERENV','DB_NAME') DB_NAME
,SYS_CONTEXT('USERENV','HOST') HOST
,SYS_CONTEXT('USERENV','OS_USER') OS_USER
,SYS_CONTEXT('USERENV','EXTERNAL_NAME') EXTERNAL_NAME
,SYS_CONTEXT('USERENV','IP_ADDRESS') IP_ADDRESS
,SYS_CONTEXT('USERENV','NETWORK_PROTOCOL') NETWORK_PROTOCOL
,SYS_CONTEXT('USERENV','AUTHENTICATION_TYPE') AUTHENTICATION_TYPE from dual;
end if;
commit;
end loop;
END IF;
exception
when others then
NULL;
end trg_no_sys_logon_3;
/

TRIGGER LOGOFF

Step 1: Logon to the database

Logon to the database using any user such as HR, SH, OE or any other you want.
1
C:\> SQLPLUS hr/hr

Step 2: Create a table.

Create a table to dump the data generated by your schema level logoff trigger.
1
2
3
4
5
6
7
8
CREATE TABLE hr_evnt_audit
 (
  event_type VARCHAR2(30),
  logon_date DATE,
  logon_time VARCHAR2(15),
  logof_date DATE,
  logof_time VARCHAR2(15)
 );

Step 3: Write the trigger.

Below written trigger will execute every time user HR logs off from the database.
1
2
3
4
5
6
7
8
9
10
11
12
13
CREATE OR REPLACE TRIGGER log_off_audit
BEFORE LOGOFF ON SCHEMA
BEGIN
  INSERT INTO hr_evnt_audit VALUES(
    ora_sysevent,
    NULL,
    NULL,
    SYSDATE,
    TO_CHAR(sysdate, 'hh24:mi:ss')
  );
  COMMIT;
END;
/