This occurs often after problems on the database (out of space in the os...).
The notifications are one of the most important features of the Enterprise-Manager, you are warned if the space is too low or if something takes too much cpu, if the backup has succeeded and a lot of other things.
The sending of the notifications is done by jobs that are defined in the sysman schema.
To repair this jobs, just delete and resubmit them.
This can be done by logging in as "sysman" user, and executing following procedures:
Have you ever been in the situation to test a piece of code in Oracle and you don't have the required data. With the WITH-clause it is now possible to create the testdata without a lot of effort to create other tables. Look at this statement:WITH myTestTab AS (
SELECT 'Roger' FIRST_NAME,
TO_DATE('01.01.1970','DD.MM.YYYY') DAY_OF_BIRTH FROM DUAL UNION
SELECT 'Hoger' FIRST_NAME,
TO_DATE('01.01.1980','DD.MM.YYYY') DAY_OF_BIRTH FROM DUAL UNION
SELECT 'Noger' FIRST_NAME,
TO_DATE('01.01.1975','DD.MM.YYYY') DAY_OF_BIRTH FROM DUAL UNION
SELECT 'Doger' FIRST_NAME,
TO_DATE('01.01.1985','DD.MM.YYYY') DAY_OF_BIRTH FROM DUAL
WHERE DAY_OF_BIRTH BETWEEN TO_DATE('01.01.1969','DD.MM.YYYY')
The Blue section is the definition of the "virtual" table and the red section is the select-statement that accesses this "virtual" table.
You can easy simulate a table the table can also be named like the 'real' table where you have no Test-Data available. You want the Oracle-Documentation for this clause? I can't help you, i looked a lot in the whole documentation and got a lot of hits, but mostly they are about another with-clause (for materialized views) . If somebody finds the docu for that, please let me know!
Today i had time enough to finish the installation on debian. I started the Oracle-Installer and it started as used on windows, but it got stuck when recompiling SQLNet and the Database itself. The error was "Error in invoking target..." After looking in Metalink, it seems to be a problem of a wrong compilier. After looking in the web for such problems i found the hint that the following packages have to be installed:
there were some packages (i did not write them down ) that were not installed, and after retrying.... IT WORKED!
The installation finished without any problem, database started up and the Enterprise-Manager Console also worked without any problems...
Installation of Gnome worked fine.... but how can i access this desktop remote?
I decided to use VNC, because i already worked with it. So i installed
the package "tightvncserver" with "aptitude install tightvncserver"
and started it with vncserver. As VNC-Client i tried to use the
tightvnc-client, but it was much slower than the ultra-vnc, i don't
know exactly why, sometimes misconfiguration. The next problem was
that i got a console but no gnome-desktop. I forgot to configure the
vncserver. I had to edit the file /root/.vnc/xstartup disabled x-windows and added gnome. Now it looks like this:
xsetroot -solid grey
x-terminal-emulator -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &
exec gnome-session &
For KDE your file would look like this:
xsetroot -solid grey
x-terminal-emulator -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &
After starting with "vncserver" i was able to access the remote machine by my Windows-XP UltraVnc-client.
The next step was to get the linux installation package from the oracle-site. There are a lot of HOWTOS available on the net, i used this one. After successfully configuring my Debian i was starting the OracleInstaller...
Last week i was testing to install Oracle on Debian. Linux is the most important operating system for Oracle Databases and so i was testing how far it would come if a Linux-dummy (ME!) is doing an Oracle-Installation on Linux. The first step was getting a grip on the operating-system. You have to know how to list files, find files and do other Operating System-Basics . I decided to make the installation on Debian because it is a easy and stable solution... and was recommended to me by a friend who is also hosting my Linux-Server. He did a basic-installation on a VM-Ware Server, i got the root account, and then i started to make my first experiences.
A very important thing is to install packages. And with Debian it is pretty easy you just have to use aptitude. That means executing the following code will install the unzip-package: aptitude install unzip
The next step was to install a GUI. A GUI is the right thing for a beginner you can navigate, create files browse without a deeper knowledge of the operating-system. I decided to use gnome, reason ... none ... just need gui. That means "aptitude install gnome".
If you are using Oracle-Reports and you want to execute a report "asynchronous" that means you start the report, and you don't want to wait with processing until the report has finished, the easiest way is to use the SRW-API. The SRW-API is a simple PL/SQL package. You can start reports and look after them by checking the status. The installation-scripts can be found in the Reports-Server-Home\reports\admin\sql. There are two scripts one for installation and one for grant (srwapiins.sql, srwapigrant.sql). After reading the package-specification you should be able to call your reports really simple way. This simplicity is also the reason why i like it more than the forms-builtin procedures.
Last week a i defined a new materialized view, and the on-commit was not working. After hours reading manuals, i found out that in the definition if you define FAST and ON COMMIT, fast is taken . That means
"CREATE MATERIALIZED VIEW MV_TEST BUILD IMMEDIATE REFRESH FAST ON COMMIT AS...." does a fast-refresh
"CREATE MATERIALIZED VIEW MV_TEST BUILD IMMEDIATE REFRESH ON COMMIT AS...." does a on-commit
I am using materialized views a lot, and they are a handy thing (in older versions the were named SNAPSHOT). If you have for example a lot of statistic stuff on your customer (how many purchases the last 7 days, how many in average over the year, how many contacts.... it is a lot of CPU and IO you need just for information that are not so important to be actual in real-time. In this case you can use Materialized Views (MV).
A creation of a materialized views would look like this (more infos in the manuals there are a lot of options!!!):
CREATE MATERIALIZED VIEW MV_TEST
START WITH SYSDATE NEXT SYSDATE + 1 AS SELECT * FROM .....
In Oracle also a "fast refreshe" is possible, that means just the changed rows of the "master" table are written to the materialized view (100000 customers, just 5000 purchased something today so just 5000 changes are written to the MV).
In some cases you also need the "on commit" feature. This is basically a fast refresh every time a record gets commited to the master-table.
If you want to know why some characters are not displayed directly and want to know the character-set of your Oracle-database just use the following select-statement:
select * from v$nls_parameters where parameter='NLS_CHARACTERSET';
After installing a database sometimes sys objects are invalid, and don't recompile. In this case you have to use the script utlrp.sql. You can find this script on the database-machine in the RDBMS-directory where the oracle-software is installed for example C:\oracle\product\10.2.0\db_1\RDBMS\ADMIN. These scripts sometimes don't work with sql-tools. So i prefer to use plain SQLPLUS on the machine directly. Just connect as SYS and execute the scripts like this:
- cd C:\oracle\product\10.2.0\db_1\RDBMS\ADMIN
- SET ORACLE_SID=STRANGEDATABASE
- sqlplus sys/change_on_install as sysdba
- start utlrp.sql
I was converting date columns in a log-table to the new timestamp datatype. This datatype is more precise and can handle milliseconds. After recompiling my Packages i got the errors
ORA-06552: PL/SQL: Compilation unit analysis terminated
ORA-06553: PLS-320: the declaration of the type of this expression is incomplete or malformed
There was no line that was wrong so this error-message didn't give me a glue what was wrong (i guess that's the sense of some oracle-error-messages "just to confuse the russians" ).
The reason was that the column name was "timestamp" what is the exact name of the datatype. After renaming it to "timestmp" it worked perfectly.
If you want to ensure in Oracle that a user can just access his own records, for example example his contacts, you can do it in several ways.
- The first would be to realize it in the application, that means you add an where-clause there. So this where-clause has to be added in every select-statement that access the "contacts" table. I dislike this option because it is to much wacork and very soon anyone will forget the where-clause and somebody can see data he is not supposed to see.
- The second would be to use the "fine grained access control" a feature from Oracl. With this feature you can add a where-clause to the table. That is a perfect solution but has one big disadvantage, the tuning of an select-statement. The access-control adds another select-statement that restricts the original query. If you have a huge table that you want to restrict, it is uncomfortable to tune. But nevertheless it can be the perfect solution. In my case it was to untransparent to other developers and we would have to rewrite a huge part of our application. So i choose the following.
- Another way would be to use an application context and use views for access-controls. Following example to demonstrate that.
CREATE CONTEXT TESTCONTEXT USING SCOTT.TESTPACKAGE;
This creates a context and defines that just the package scott.testpackage is allowed to set values to this context, this Package has the procedure setUser just a minimal version without error-handling etc.:
PROCEDURE setUser (pUser IN USER_INFO.USERNAME%TYPE) IS
DBMS_SESSION.SET_CONTEXT( 'UserInfoContext' 'UserName', pUser);
END;CREATE OR REPLACE VIEW V_CONTACTS AS SELECT * FROM CONTACTS WHERE USR = SYS_CONTEXT('UserInfoContext','UserName')
After setting the user (at logon-time) with "exec scott.testpackage.setuser('iamthesuperuser');" you get just the records from this user.You could say that is would also be possible to use a simple pl/sql-function and that is true, but there would be performance-costing switchings between the pl/sql and the sql-engine and also the optimizer would not be able to interpret this pl/sql-function as a constant and so it would be much slower, i tested it with pl/sql and with the context and using the context is much faster.
Page 7 of 10