TRAC milestone recovery - trac

We have TRAC 0.11 server. Unfortunately we have deleted a milestone in one of our project. How to recover deleted milestone and open tickets in the deleted milstone ?
when i am running the milestone list command it is not showing my deleted milestone information. if any body know to recover deleted milestone and tickets. Help will be appreciated

Deleting a milestone does not mark it deleted so it cannot be simply recovered. Your tickets are not gone, they are just not currently associated with the deleted milestone.
What you can do is:
Recreate the milestone in Trac
Use SQL access look up the change events to find the affected ticket IDs and then update those back to the deleted milestone.
In this example the milestone is M5. You will need to determine the time when it happened so you restrict your 'fix' to the actual milestone delete event
UPDATE ticket set milestone = 'M5' WHERE id IN (
SELECT ticket FROM ticket_change WHERE
field = 'milestone' AND
oldvalue = 'M5' AND
newvalue IS NULL AND
time > '1332955533289000' -- put in the right time for where your delete happened
ORDER BY "time" DESC )

You will need a tool that lets you execute SQL directly against the database being used for Trac. By default, Trac is installed to use SQLite, The SQLite website has a good list of tools that can be used to edit SQLite data.
Find the location of your SQLite database (you can look in your trac.ini file for that) and then use any one of the tools listed on the SQLite website to execute the queries listed above.

Related

SQL Audit options for update commands where an existing column does not change

I have a need to audit changes where triggers are not performing well enough to use. In the audit I need to know exactly who made the change based on a column named LastModifiedBy (gathered at login and used in inserts and updates). We use a single SQL account to access the database so I cant use that to tie it to a user.
Scenario: Now we are researching the SQL transaction Log to determine what has changed. Table has a LastUpdatedBy column we used with trigger solution. With previous solution I had before and after transaction data so I could tell if the user making the change was the same user or a new user.
Problem: While looking at tools like DBForge Transaction Log and ApexSQL Audit I cant seem to find a solution that works. I can see the Update command but I can't tell if all the fields actually changed (Just because SQL says to update a field does not mean it actually changed value). ApexSQL Audit does have a before and after capability but if the LastUpdatedBy field does not change then I don't know what the original value is.
Trigger problem: Large data updates and inserts are crushing performance because of the triggers. I am gathering before and after data in the triggers so I can tell exactly what changed. But this volume of data is taking a 2 second update of 1000 rows and making it last longer than 3 minutes.

Remove All Permission In SSRS 2008

Must remove all the permissions SSRS 2008 all reports and leave only one group, is there any way via script in PS, VB, T-SQL that performs this task?
I can see 2 ways of doing it:
The recommended (supported) way
Go through all reports and restore the parent security.
This can take a lot of time depending on the number or reports you have.
The unsupported way
This should do what you want without too much work, but is quite risky.
Backup your ReportServer DB (important)
Apply the permissions you want on the root in the web interface
Go in the Catalog table and look for the PolicyID of the corresponding entry (it should be the first line, with almost all other columns = NULL, and PolicyRoot = 1)
Execute the following query:
update [dbo].[Catalog] set [PolicyID] = <YourRootPolicyID>
(Optional) Clean the PolicyUserRole table, which maps a user to a role and a policy:
delete from [dbo].[PolicyUserRole] where [PolicyID] <> <YourRootPolicyID>
(Optional) Clean the Policies table, which holds the list of policies (= security settings):
delete from [dbo].[Policies] where [PolicyID] <> <YourRootPolicyID>
All your items will now have same the security settings.

Log who deleted a row using Change Data Capture

I have SQL 2014 Enterprise and have configured Change Data Capture (CDC). I have UserId columns on all of my tables. So CDC does a great job seeing who inserted and updated a row but if someone deletes a row I cant see who deleted the row (it has the previous UserId in the row). I know Oracle has this feature included in their CDC package.
Create a trigger after delete which stores the userid of whoever deleted the data. you'd want to have a table setup that has restricted access, likely to the admin, to store the information.

How can i get the row that is already deleted using Oracle Data Change Notification?

I'm currently working on a data change notification in my project and I need to retrieve the rows that are modified ( INSERT/UPDATE/DELETE) using Ora DCN.
I don't have any problem with INSERT/UPDATE operation, my problem is when a row is deleted. I want to retrieve the rows that are deleted so that I can update a backup database in separate server.
FYI: I don't want to use a trigger for this.
Any suggestions?
Before deleteing a row.Insert that row to a back up table and after inserting .Delete that row.
Ex..
INSERT INTO backup_table
VALUES (value1,value2,value3,...);
DELETE FROM table_name
WHERE some_column=some_value;
You have misunderstood the use case for DCN. Its prime function is to allow external apps to keep their caches up-to-date.
Triggers constitute an appropriate mechanism for doing what you need, so it's a bit puzzling that you don't want to use them.
Alternatively there is Flashback Archive, it you have the appropriate database edition (before 11.0.2.4 it requires an additional license purchase). Find out more.

Auditing logged in user with delete trigger

We have an audit option in our application, where we are auditing the deleted records from a table using AFTER DELETE ON trigger.
Problem description :
The problem that we face here is, we need to log the person who has deleted the record. We could not get id of the person deleted the record anywhere from the database as its not present. Its coming from the web application. My question is there anyway to get the name or id of the person who has logged into the web application in the database side.
We are using oracle 11g.
You should be able to do this using dbms_session package.Using the package you can set and get values.Hence , during the login to your application , you can set the value and finally while on delete trigger execution , get this and insert into the audit table.
This might come handy - http://www.dba-oracle.com/t_dbms_session.htm
Hope that helps !