Here is the simple query, showing who is connected to the server.
col username FOR a15 col program FOR a25 trun SELECT sid, serial#, username, program, SUBSTR(module,1,10) module, logon_time FROM v$session ORDER BY 1,2;
This is almost the same query, limiting the output to the active users:
SELECT sid, serial#, username, program, SUBSTR(module,1,10) module, logon_time [...]
news and informations automotive,business,crime,health,life,politics,science,technology,travelautomotive,business,crime,health,life,politics,science,technology,travel
The command to kill Oracle is simple:
ALTER SYSTEM KILL SESSION ‘&sid,&serial’;
sid – session ID serial – session serial number
If the version 11g and this is RAC, additional syntax is possible:
ALTER SYSTEM KILL SESSION ‘&sid,&serial,@&inst_id’;
inst_id – instance id number (1, 2, 3 …)
Script to find the TOAD session [...]
news and informations automotive,business,crime,health,life,politics,science,technology,travelautomotive,business,crime,health,life,politics,science,technology,travel
If the password for the mysql “root” user is lost, it’s still possible reset it to some other value. The restart of the mySQL server will be necessary, of course.
The following should be done:
Stop the server It could be done normally:
/etc/init.d/mysql stop
or effectively:
ps -ef | grep mysql … mysql 25079 [...]
news and informations automotive,business,crime,health,life,politics,science,technology,travelautomotive,business,crime,health,life,politics,science,technology,travel
The easiest method to get the tablespace structure is to use the dbms_metadata package:
SET linesize 200 LONG 50000 pagesize 5000 SELECT dbms_metadata.get_ddl(’TABLESPACE’,tablespace_name ) FROM dba_tablespaces WHERE tablespace_name IN ( ‘&your_tablespace’ );
Additionally, exp/imp (or expdp/impdp) utilities could be used. They could generate the DDL statements for all objects in the database, which could be [...]
news and informations automotive,business,crime,health,life,politics,science,technology,travelautomotive,business,crime,health,life,politics,science,technology,travel
Sometimes it’s necessary to show the output of the PL/SQL script. Usually the dbms_output package is used:
SET serveroutput ON DECLARE i NUMBER ; BEGIN i:=0 ; WHILE i< 100000 LOOP i:=i+1 ; dbms_output.put_line(’This is just test line #’ || TO_CHAR(i) ) ; END LOOP ; END; /
After several thousands lines the [...]
news and informations automotive,business,crime,health,life,politics,science,technology,travelautomotive,business,crime,health,life,politics,science,technology,travel
Here is the simple script for cloning the Oracle profiles.
SET serveroutput ON DECLARE CURSOR c_profiles IS SELECT PROFILE, RESOURCE_NAME, LIMIT FROM dba_profiles ORDER BY PROFILE, resource_name; s_PROFILE dba_profiles.PROFILE%TYPE ; s_prev_PROFILE dba_profiles.PROFILE%TYPE ; s_RESOURCE_NAME [...]
news and informations automotive,business,crime,health,life,politics,science,technology,travelautomotive,business,crime,health,life,politics,science,technology,travel
There are several methods to put the quote into the string.
The first (and very traditional) one: use 2 quotes.
SELECT ‘This ” is quote’ FROM dual;
If there are more than one quote, it’s difficult to read and write such strings
The second: use chr(39)
SELECT ‘This ‘ || CHR(39) || ‘ is quote’ [...]
news and informations automotive,business,crime,health,life,politics,science,technology,travelautomotive,business,crime,health,life,politics,science,technology,travel
I’ve got the following message relinking the binaries on Solaris:
ld: fatal: dlopen() of support library (libmakestate.so.1) failed with error:
ld.so.1: /usr/ccs/bin/sparcv9/ld: fatal: /usr/lib/libmakestate.so.1: wrong ELF class: ELFCLASS32
The problem was caused by missing 64-bit library libmakestate.so.1 in /usr/lib.
The normal library should look like the following:
[#] file /usr/lib/sparcv9/libmakestate.so.1 libmakestate.so.1: ELF 64-bit MSB dynamic [...]
news and informations automotive,business,crime,health,life,politics,science,technology,travelautomotive,business,crime,health,life,politics,science,technology,travel
The function takes some expression as the argument and executes it, returning output in the varchar string
CREATE OR REPLACE FUNCTION eval (expr VARCHAR2) RETURN VARCHAR2 AS ret VARCHAR2(4000); BEGIN EXECUTE IMMEDIATE ‘begin :result := ‘ || expr || ‘; end;’ USING OUT ret; RETURN ret; END; /
The discussion and examples [...]
news and informations automotive,business,crime,health,life,politics,science,technology,travelautomotive,business,crime,health,life,politics,science,technology,travel
This piece of code show the list of events, set in the Oracle database
SET serveroutput ON DECLARE event_level NUMBER; BEGIN dbms_output.enable(20000) ; FOR i IN 10000..33999 LOOP sys.dbms_system.read_ev(i,event_level); IF (event_level > 0) THEN dbms_output.put_line(’Event ‘||TO_CHAR(i)||’ set at level ‘|| TO_CHAR(event_level));
END IF;
END LOOP;
END;
news and informations automotive,business,crime,health,life,politics,science,technology,travelautomotive,business,crime,health,life,politics,science,technology,travel
|
|