Showing posts with label Oracle. Show all posts
Showing posts with label Oracle. Show all posts

Entityframework Oracle.ManagedDataAccess.Client.OracleException: 'ORA-01950: no privileges on tablespace 'USERS''

I used EF to connect to Oracle database and  I received the following error
Oracle.ManagedDataAccess.Client.OracleException: 'ORA-01950: no privileges on tablespace 'USERS''
In my case the connection string has invalid value.
the user password was typed wrong.


EntityFramework Oracle.ManagedDataAccess.Client.OracleException: 'ORA-01918: user 'dbo' does not exist'

While trying to use code first approach to connect to Oracle database using ASP NET C#.
I received the following exception
Oracle.ManagedDataAccess.Client.OracleException: 'ORA-01918: user 'dbo' does not exist'
My current User Is IT_USER
The Reason for the error is that Oracle tried to create my tables which are in my first migration into dbo schema as SQL Server do, but in Oracle it is a User.

So you need to till Entity Framework where is my Table Should be
You have two solutions

First is to use DbModelBuilder.HasDefaultSchema
This will make all of your tables in this schema.

protected override void OnModelCreating(DbModelBuilder modelBuilder)
{
    modelBuilder.HasDefaultSchema("IT_USER"); 
    base.OnModelCreating(modelBuilder);
}

Second is to use System.ComponentModel.DataAnnotations.Schema.Table
This will give you the ability to change the schema when ever you want
[Table("STD_FA_VALIDATION", Schema ="IT_USER")] 
public class STD_FA_VALIDATION
{
    [Key]
    [DatabaseGenerated(DatabaseGeneratedOption.None)]
    public int SGBSTDN_PIDM { get; set; }
    public string NAT_CHANGE_IND { get; set; }
    public string WORK_IND { get; set; }
    public DateTime NAT_PROC_DATE { get; set; }
    public DateTime WORK_PROC_DATE { get; set; }
 }

How to create OWA_COOKIE PLSQL

The Oracle Web Agent (OWA) provide the web users with an easy way to send and get cookies throw the browser header using OWA_COOKIE package.
there is two types can be used for OWA_COOKIE
  1. type vc_arr is table of varchar2(4000) index by binary_integer.
  2. type cookie is record (name varchar2(4000),vals vc_arr,num_vals integer); 
  1. Open Header
  2. Send Cookie 
  3. Close Header 
  4. Redirect to another page. 
don't forget to close the header. 

if for some reason you find the cookie value printed into the screen then your document header maybe was opened  and closed before your cookie code. 

BEGIN
OWA_UTIL.MIME_HEADER ('text/html', FALSE);
OWA_COOKIE.SEND (NAME    => 'REGIND',VALUE   => TWBKBSSF.F_ENCODE ('N'));
OWA_UTIL.HTTP_HEADER_CLOSE;
OWA_UTIL.REDIRECT_URL ('xwskstrg.P_RegsAddCrse');
END;
make sure that you encrypt the value of the cookie if it will contain a sensitive data.

Modify AWR Automatic Snapshot Settings

DBA_HIST_WR_CONTROL table shows the AWR snapshot settings.
In this example the retention period is specified as 1 month (43200 minutes) and the interval between each snapshot is 30 minutes.

BEGIN
DBMS_WORKLOAD_REPOSITORY.MODIFY_SNAPSHOT_SETTINGS (INTERVAL => 30,RETENTION => 43200);
END

SELECT * FROM DBA_HIST_WR_CONTROL

After executing  DBMS_WORKLOAD_REPOSITORY.MODIFY_SNAPSHOT_SETTINGS  procedure you can get the AWR Report for each 30 min the hole year.

filter attribute that checks whether current connection is secured

using APS.net Core to mark all website pages working with https protocol we will do this using IAuthorizationFilter. and here is an exampl...