Audit trail setting in oracle 11g - oracle11g

I would like to know how to view the oracle 11g audit setting.
i need to check if it is enabled or not.
I read audit_trail will help but when i run the query "select * from audit_trail" it returns invalid table error.

You can check the audit status via
SHOW parameter audit_trail
or
SELECT name, value FROM v$parameter WHERE name = 'audit_trail';
if it is set to none then auditing if off, anything else and it is on.
See here for more information on the choices for this value.

Related

Why is my Airflow MySqlOperator Insert Command Denied?

I'm running a dag with an insert query. Here is some of the code:
QUERY = '''
INSERT INTO bi.target_skus (skus)
SELECT
distinct od.sku,
FROM
bi.orders as od'''
t1 = MySqlOperator(
sql=QUERY,
mysql_conn_id = MYSQL_CONN_ID,
task_id='target_skus',
dag=dag)
It's giving me the following error:
ERROR - (1142, "INSERT command denied to user 'xyz' for table 'target_skus'")
A few notes:
Devops said my user has permission to make inserts into that table
Select commands work fine
The error message does not include the database name (bi) even though my insert query does.
This looks like a standard MySQL "not enough privileges" error.
Are you sure you can perform INSERTs with your user, regardless of what your DBA is saying? You should test the same operation using another tool (like MySQL Workbench) setting up the connection in the same way you set it up in Airflow, i.e. same user, same password, same default schema.
It looks like a privilege error from the user trying to insert but there is a comma in the insert that can cause problems too:
QUERY = '''
INSERT INTO bi.target_skus (skus)
SELECT
distinct od.sku
FROM
bi.orders as od'''

Invalid object name 'product_Design'

I am getting this error while saving my data into the table. I have already created a 'product_Design' table in my database. I am using Sql Server 2008. Everything is working fine on local host but not on the server. I also tried to insert data in different tables and its working but I am just not able to insert data in this(product_Design) table ? I really need help regarding this thing.
here is my sql query
insert into z3ctjholo.dbo.product_Design values(#prodID, #productName, #designName, #designPath, #finalDesign, #front, #cont, #divHeight, GETDATE(), 0, 1)
I also tried this query
insert into product_Design values(#prodID, #productName, #designName, #designPath, #finalDesign, #front, #cont, #divHeight, GETDATE(), 0, 1)
Both the queries are generating error. Please help me out.
Thanks..
So finally i found what is the problem. if you ever face such kind of problem then execute this command in sql server and see whether your table is connected to any schema apart from dbo. Use this statement to check whether the table is connected to any other schema.
use yourDatabaseName
Then
SELECT * FROM INFORMATION_SCHEMA.TABLES
after that if you find that your table is connected with other schema apart from dbo then use your any statement like this
select * from schemaName.tableName
(eg. my schema name is z3ctjholo and my table name is product_Design)
so my statement would be like this
select * from z3ctjholo.product_Design
what i was doing wrong, i was using two schema names (z3ctjholo.dbo.product_Design).
I hope it will help someone..
Thanks...
There are two reasons, I can find so far.
1. Either the connection settings in web.config is incorrect.
2. your database is case sensitive collation and so check the name with case. May be you have created the table with name Product_Design and trying to insert in product_Design, in this case also, the command may not work.
Please check both the points.

select Oracle Table from toad without specifying the Schema

Hi Guys I am running an Oracle DB and I have to Write the Schema(Owner) name before selecting the Table. I find this Quite Unnecessary especially when am Logged in as the Table Owner Like:
select * from MUNGAI.Employees;
When am Actually Logged in as user MUNGAI the same Who Created the table. I want to be able to select like:
select * from Empployees;
From this I get the Error On Toad....On SQLDEVELOPER I get No Error and I want to Use TOAD
ORA-00942: table or view does not exist
Any Ideas on How to Achieev this??
I have to Write the Schema(Owner) name before selecting the Table.
No, you don't have to. Why do you think so? Did you even try it?
When you are logged in as the owner of the table you do not have to specify the schema.
Any Ideas on How to Achieev this??
Yes, simply write
select * from Employees;
Again: this works if - and only if1)) - you are logged in as MUNGAI.
1) leaving things like public synonyms aside

run-time error '3197'. MS Access 2010 and SQL Server 2008R2

I have an application written in MS Access 2007-2010 and a back end is an SQL database.
After building a new database, when I view the records from SQL in the Access report, trying to edit or enter new input results with a run-time error 3197.
The specific error says:
This record has been changed by another user since you started editing it
Then I have Copy to Clipboard and Drop Changes options, while the Save Record is grayed out.
Clicking on the Drop changes brings the error:
"Run-Time Error '3197'
The Microsoft Access database engine stopped the process because you and another user are attempting to change the same data at the same time."
I then looked in the SQL and queried the database with EXEC sp_who2 'Active' and I can see that the user name I use for SQL is RUNNABLE while the user used by the Access application (coded in Access VBA) is SUSPENDED (the command it is suspended on is SELECT).
I have other databases that are constructed the same way and work with no issues. I've checked sp_who2 on the working database when it's running with Access, and the user that is SUSPENDED for the "problematic" database, is sleeping with this one.
I've checked the permissions for both databases, and checked the permissions for the users in Security--> Logins and don't see anything that I can flag as an issue (maybe someone else can?).
Not sure why this is happening and why the database is locked by the SQL user and won't let the Access user update the relevant records.
Can anyone shed some light on this issue?
Thanks.
As Remou commented, changing all bit data types to smallint and populating with 0 where Null did the trick. I didn't need to change 1 to -1 as my fields where to be in the initial state of unticked (=0).
As suggested, I updated the data in the field that had the bit datatype from null to 0, also changed the datatype to int. That fixed the problem.
I had the same issue,
sql2 = "Select * from voeding where id = " & ID_Voeding_Site.Value & ""
Set rst2 = bbase.OpenRecordset(sql2)
rst2.Edit
rst2.Fields("verwerkt").Value = 1
rst2.Fields("printdatum").Value = Date
rst2.Update
rst2.Close
Was stuck on .update. I Changed it to:
sql2 = "Select Verwerkt, Printdatum from voeding where id = " & ID_Voeding_Site.Value & ""
Set rst2 = bbase.OpenRecordset(sql2)
rst2.Edit
rst2.Fields("verwerkt").Value = 1
rst2.Fields("printdatum").Value = Date
rst2.Update
rst2.Close
No More troubles appeared. Hope this helps others.

Community server Username issue - User Username not found in membership store does not exist

I have an error occuring frequently from our community server installation whenever the googlesitemap.ashx is traversed on a specific sectionID. I suspect that a username has been amended but the posts havn't recached to reflect this.
Is there a way a can check the data integruity by performing a select statement on the database, alternatively is there a way to force the database to recache?
This error could be thrown by community server if it finds users that aren't in the instance of MemberRoleProfileProvider.
See CommunityServer.Users AddMembershipDataToUser() as an example
UPDATE:
I Solved this problem for my case by noticing that the usernames are stored in two tables - cs_Users and aspnet_Users. Turns out somehow the username was DIFFERENT in each table. Manually updating so the names were the same fixed this problem.
Also, the user would left out of membership in the following line of the stored procedure cs_Membership_GetUsersByName:
INSERT INTO #tbUsers
SELECT UserId
FROM dbo.aspnet_Users ar, #tbNames t
WHERE LOWER(t.Name) = ar.LoweredUserName AND ar.ApplicationId = #ApplicationId
The #tbNames is a table of names comes from cs_Users(?) at some point and therefore the usernames didn't match and user was not inserted in to the result later on.
See also: http://dev.communityserver.com/forums/t/490899.aspx?PageIndex=2
Not so much an answer, but you can find the affected data entries by running the following query...
Select *
FROM cs_Posts
Where UserID Not In (Select UserID
From cs_Users Where UserAccountStatus = 2)

Resources