Lock users selected from query.
I need to have the user IDs that are selected using the query I've pasted below locked. My thought was to put the query into an array and then use a loop to run through the array with the "alter user user_id account lock" command but I have no idea how to get that far is that even possible with plsql? Or perhaps there is a better way to do this. I would then be running this script once a week to make sure all of these users are locked.
select username from dba_users where username like '_Z%'
minus
select distinct schema from monadmin.log_info where timestamp>=sysdate-92
minus
select account_status from dba_users where account_status = 'locked';
select account_status from dba_users where account_status = 'locked';This will not return anything as the status is LOCKED not locked.
secondly you will get account_status not the username
BEGIN
FOR rec IN (
select username from dba_users where username like '_Z%'
minus
select distinct schema from monadmin.log_info where timestamp>=sysdate-92
minus
select username from dba_users where account_status like ( '%LOCKED')
) LOOP
EXECUTE IMMEDIATE 'ALTER "' || rec.username || '" ACCOUNT LOCK';
END LOOP;
END;
/ Alvinder
Edited by: alvinder on Mar 18, 2009 10:54 AM
Similar Messages
-
A way to convert selection from query builder in DML language
I search a way to convert selection from query builder in DML language.
regardsWe will make a sample from this request and post it on OTN. I have pasted all the JSP code so you should be able to use it directly. Just change the BISession details and the presentation references.
<%@ taglib uri="http://xmlns.oracle.com/bibeans" prefix="orabi" %>
<%@ page contentType="text/html;charset=windows-1252"%>
<%@ page import="java.util.Vector" %>
<%@ page import="oracle.dss.thin.beans.crosstab.ThinCrosstab" %>
<%@ page import="oracle.dss.util.DataAccess" %>
<%@ page import="oracle.dss.selection.Selection" %>
<%@ page import="oracle.dss.thin.beans.graph.ThinGraph" %>
<%@ page import="oracle.dss.dataSource.client.QueryClient"%>
<%-- Start synchronization of the BI tags --%>
<% synchronized(session){ %>
<orabi:BIThinSession id="BIThinSession1" configuration="/Project1BIConfig1.xml" >
<orabi:Presentation id="untitled2_Presentation1" location="Presentation1" />
<orabi:Presentation id="untitled2_Presentation2" location="Presentation2" />
</orabi:BIThinSession>
<%
String CROSSTAB_ID = "untitled2_Presentation2";
String GRAPH_ID = "untitled2_Presentation1";
String MYProducts = "Nothing";
String prodID = "MDM!D_CS_OLAP.SHAWPRODUCTS";
//Find the crosstab object on the page
Object crosstabObject = pageContext.findAttribute(CROSSTAB_ID);
ThinCrosstab thinCrosstab = (ThinCrosstab)crosstabObject;
//Get the various query components from the Crosstab
QueryClient myQCXtab = (QueryClient)thinCrosstab.getDataSource();
Selection mySelXtab = myQCXtab.findSelection(prodID);
DataAccess daXtab = myQCXtab.createQueryAccess().getDataAccess(mySelXtab);
// This is a one-d data access, only has the column edge
int colExtentXtab = daXtab.getEdgeExtent(oracle.dss.util.DataDirector.COLUMN_EDGE);
for (int i=0; i<colExtentXtab; i++)
String memberLabel = (String)daXtab.getMemberMetadata(oracle.dss.util.DataDirector.COLUMN_EDGE, 0, i, oracle.dss.util.MetadataMap.METADATA_LONGLABEL);
String memberValue = (String)daXtab.getMemberMetadata(oracle.dss.util.DataDirector.COLUMN_EDGE, 0, i, oracle.dss.util.MetadataMap.METADATA_VALUE);
System.out.println(memberLabel + " " + memberValue);
// As above except for graphs.
Object graphObject = pageContext.findAttribute(GRAPH_ID);
ThinGraph thinGraph = (ThinGraph)graphObject;
QueryClient myQCGraph = (QueryClient)thinGraph.getDataSource();
Selection mySelGraph = myQCGraph.findSelection(prodID);
DataAccess daGraph = myQCGraph.createQueryAccess().getDataAccess(mySelGraph);
// This is a one-d data access, only has the column edge
int colExtentGraph = daGraph.getEdgeExtent(oracle.dss.util.DataDirector.COLUMN_EDGE);
for (int i=0; i<colExtentGraph; i++)
String memberLabel = (String)daGraph.getMemberMetadata(oracle.dss.util.DataDirector.COLUMN_EDGE, 0, i, oracle.dss.util.MetadataMap.METADATA_LONGLABEL);
String memberValue = (String)daGraph.getMemberMetadata(oracle.dss.util.DataDirector.COLUMN_EDGE, 0, i, oracle.dss.util.MetadataMap.METADATA_VALUE);
System.out.println(memberLabel + " " + memberValue);
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>
Hello World
</title>
</head>
<body>
<FORM name="BIForm">
<!-- Insert your Business Intelligence tags here -->
<orabi:Render targetId="untitled2_Presentation1" parentForm="BIForm" />
<orabi:Render targetId="untitled2_Presentation2" parentForm="BIForm" />
<%-- The InsertHiddenFields tag adds state fields to the parent form tag --%>
<orabi:InsertHiddenFields parentForm="BIForm" biThinSessionId="BIThinSession1" />
</FORM>
<h2>
The current time is:
</h2>
<p>
<%= new java.util.Date() %></p>
<input type="text" name="MyTextField" value=MYProducts readonly>
</body>
</html>
<% } %>
<%-- End synchronization of the BI tags --%>
Hope this helps
Business Intelligence Beans Product Management Team
Oracle Corporation -
How to let the user select from more then 1 data templet file to fillin a field
help i have a form the has 5 free form text fields that i need to select from a list of texts to fill it in and then allow the user to add to the data.
thanksthanks here are 2 strings
COPD continue O2 by NC/Albuterol MDI/ Atrovent MDI/ Duonebs/ Albuterol MDI/ Prednisone taper/ IV Solumedrol/ Spiva/ Advair diskus/ oximetry prn/ PT/ OT/ Coreg
CAD/ANGINA cont. O2 by NC?baby ASA/ ASA/ Lopressor/Atenolol/ Lisinopril/ Low fat diet/ PT/OT/ sublingual nitroglycerin prn/ Lasix/ Lipitor/ Zocor/ Mevacor
i would like the user to be able to select from inside of the field when it is blank (fisrt time entering data)
thanks again -
How to assign tasks in Approval Workflow to a set of users selected from a Lookup table
Hi all,
I am new to Project Server and I am using Project Server 2013 On premises deployement. Please help me on how to achieve the below scenario:
I have a requirement where, the initial PDP will have 2 fields (Reviewers and Approvers), wherein the engineer himself will select who the reviewer and approver from the Lookup tables.
Now I have to start task process with these selected people for approval.
Say for example , engineer has selected Alice and Bob as 2 reviewers, then
In the workflow I have :
Start Task process with
Project Data: Reviewers (which is giving error as
[System.ArgumentException: AssignedTo at Microsoft.Activities.Hosting.Runtime.Subroutine.SubroutineChild.Execute(CodeActivityContext context) at System.Activities.CodeActivity.InternalExecute(ActivityInstance instance, ActivityExecutor executor, BookmarkManager
bookmarkManager) at System.Activities.Runtime.ActivityExecutor.ExecuteActivityWorkItem.ExecuteBody(ActivityExecutor executor, BookmarkManager bookmarkManager, Location resultLocation) ]
Then I tried logging the value of Project Data: Reviewers, It logged the value as Alice, Bob (which looks pretty good),
Then I tried assigning only 1 person as Reviewer, then also I get the same error.
So can anybody please tell me where I went wrong. Is it not possible to fetch the data from the values selected as Project Data from the Lookup tables ? If not then what is the workaround I can use to achieve this ?
Thanks,
ShankyHi Paul,
Yes I am using SP designer for Workflows. And yes, You were right, there was a mismatch in the names of AD account and the Lookup table, now with 1 person selected from the lookup table it is assigning the task properly. However with multiple selection,
it is failing.
As Robert mentioned, the fetched value is a text as "Alice, Bob", which makes 2 usernames as a single text. So when I try to assign a task to this group, which returns value as "Alice, Bob", workflow fails to find such AD user, as it
is an invalid value.
So is there any way I can seperate this out to form 2 different username ? I checked for string extraction function in th Workflow, but nothing helped me for this scenario.
Any input will be helpful.
Thanks,
Shanky -
Distinguishing user selections from programmatic selections in JList
I have two jlists., and registered a subclass of ListSelectionListener on each list. When the user selects a record in the first list part of of the code I have written sets a selection on the second list which is correct, but then this triggers the listener on the second list to receive an event, and run its listener code which is not what I want.
I want to be able to identify a list selection caused by the user selecting a record in the list rather than the a programmatic selection, so that i can ignore programmatic selections.
Checking event.getSource() is no good as it always just returns the JList itself regardless of whether it has been done programtaically or by a user.
I tried checking list.isFocusOwner() , figuring that only lists that had been user selected would be focus owner. This works for Windows but on MacOS, it doesnt work the frst time you select something from the list after moving from another component (it does work after that).
How do i do this, thanks Paulan alternative is to set a flag
boolean fromList1Listener = false;//class field scope
list1Listener
fromList1Listener = true;
change list2 selection
fromList1Listener = false;
list2Listener
if(fromList1Listener == false)
normal code goes here
} -
Read user selection from slicer of pivot charts
I want to read the slicer selection made by user and use those values to get the data from SQL.
Hi,
Do you want to query the data from SQL by using slicer in pivot charts? If it is, please try to following steps:
1.Click anywhere inside the Profit % by Category PivotChart to display the PowerPivot Field List.
2.In the PowerPivot Field List, locate the DimDate table.
3.Drag CalendarYear and CalendarQuarter to the Slicers Horizontal area of the PowerPivot Field List.
4.Under the Geography table, select ContentinentName.
5.To the Slicers Vertical area of the PowerPivot Field List.
http://msdn.microsoft.com/en-us/library/gg399133(v=sql.110).aspx
If I misunderstand, please share us more information for you needs and some screenshot.
Regards,
George Zhao
TechNet Community Support
It's recommended to download and install
Configuration Analyzer Tool (OffCAT), which is developed by Microsoft Support teams. Once the tool is installed, you can run it at any time to scan for hundreds of known issues in Office
programs. -
Select from Query ? / Dynamic view ? Anything else ?
Hello,
This could be a bit challenging. (or maybe not, i hope)
I have to create a report which is based on 3/4 tables with pretty complex SQL.
Step 1. I have to use views (in the database currently) to select data from these tables.
Step 2. Then create the next set of views (in the db) based on the previous views.
Step 3. Then finally join the last set of views in Reports and create the report based on the PARAMETERS entered.
This was fine, until the client changed the criteria. Now the views have to be created but the PARAMETERS affect the FIRST set of views.
That is, the views in the FIRST STEP will have a where condition based on the parameters at RUN TIME.
I was wondering about how to do this ?
1. Can I use dynamic views (in db) passing the where condition parameter to the where clause ? Alternatively use DDL in Reports.
OR
2. Create a query in Reports and create subsequent QUERIES BASED ON THE FIRST QUERY (like MS Access). Can this be done ?
3. Any other way ?
If you need any clarification, I can provide that.
THANKS for taking the time to read it. It would be great if you could give me any ideas.
Pat.hello,
you might look into REF-CURSOR-QUERIES for this particular case. it might help.
regards,
the oracle reports team -
Displaying user selection from drop down list in static text on master page
Hello,
I am using LC 7.0 at workk and I have hit a road block.
I have a drop down list at the top of the form. Once the user makes a selection, I want to take that value and paste it in static text located on the master page. I can't seem to get it to work.
Please help!!!Hi,
Place the Drop Down list on form
Place text object(s) on master page
here is the script to display the value and/or text of drop down
Script will be on Drop Down list events
Calculate event to display value of DD - FormCalc
form1.pageSet.Page1.StaticText1.rawValue = this.rawValue;
Change event to display Text of DD - JavaScript
form1.pageSet.Page1.StaticText2.rawValue = xfa.event.newText;
SAVE the form as dynamic pdf.
Hope this will help.
Thanks,
Raghu. -
Best way to make my WDA read only when user selects from FPM toolbar
Using FPM, we've inserted a custom web dynpro application to maintain our gate dates in PPM 5.0.
When the user presses the Read Only button on the FPM toolbar, what's the best way to turn our fields off? Just create a new attribute in our Component Controller context node and bind it to all the screen fields?Hallo Robert,
I think it is the best and easy way to realize this. -
User info from dba_users along with no. of objects.
QUERY 1 - wiill give the information about locked users locked date and etc.
select a.username,a.profile,a.account_status,a.created,a.lock_date,a.expiry_date,b.granted_role
from dba_users a, dba_role_privs b
where b.grantee in (select grantee from dba_role_privs where granted_role='DBA')
and a.username=b.grantee
and a.account_status='LOCKED'
and lock_date <= (sysdate-100)
order by a.username;
QUERY 2 - this will count the no. of objects in above locked users
select owner,count(*) from dba_objects
where owner in (select a.username
from dba_users a, dba_role_privs b
where b.grantee in (select grantee from dba_role_privs where granted_role='DBA')
and a.username=b.grantee
and a.account_status='LOCKED'
and lock_date <= (sysdate-100))
group by owner;
Is there any way i can get the above two outputs using only one query instead of using two saparate ... i tried using joins but not getting throug...plz suggest.Handle: user511621
Status Level: Newbie
Registered: May 24, 2006
Total Posts: 505
Total Questions: 129 (118 unresolved)
Why so many unanswered questions?
SELECT a.username,
a.profile,
a.account_status,
a.created,
a.lock_date,
a.expiry_date,
b.granted_role,
c.owner,
COUNT(owner)
FROM dba_users a,
dba_role_privs b,
dba_objects c
WHERE b.grantee IN (SELECT grantee
FROM dba_role_privs
WHERE granted_role = 'DBA')
AND a.username = b.grantee
AND a.username = c.owner
AND a.account_status = 'LOCKED'
AND lock_date <= ( SYSDATE - 100 )
GROUP BY c.owner,
a.username,
a.profile,
a.account_status,
a.created,
a.lock_date,
a.expiry_date,
b.granted_role
ORDER BY a.username; Edited by: sb92075 on Mar 14, 2012 5:40 PM -
MySQL: SELECT * FROM with a Variable from an HTML form
Hello,
I would like to insert the variable "find" from the HTML form below in the MySQL "SELECT * FROM" query beneath it. In other words, where the word "santafe" appears below, I would like to insert the variable "$find." But I can't quite get it to work. How do I do it?
Thanks in advance,
John
<form action="tsearch11.php" method="post">
<label>Enter Topic:
<input type="text" name="find" size="55"/>
<input type="hidden" name="searching" value="yes" />
<input type="submit" name="search" value="Search" />
</label>
</form>
Then, on tsearch11.php:
<?
mysql_connect("mysqlv3", "username", "password") or die(mysql_error());
mysql_select_db("sand2") or die(mysql_error());
$find = strip_tags($find);
$find = trim ($find);
$t = "SELECT * FROM santafe";
$y = mysql_query($t);
?>Putting a form variable in a SQL query to look for table or column names requires an extra level of security. You need to create an array of the valid names, and check that the form variable is in that array.
$find = get_magic_quotes_gpc() ? stripslashes($_POST['find']) : $_POST['find'];
$find = mysql_real_escape_string(trim($find));
// create an array of valid table names
$tables = array('santafe', 'sanfernando', 'guadalupe');
// check that the variable is in the permitted array
if (in_array($find, $tables)) {
$t = "SELECT * FROM $find";
$y = mysql_query($t);
} else {
$error = 'Sorry, you selected an invalid table.';
In the page itself, check whether $y exists before using it. Otherwise display the error:
if (isset($y)) {
// display the results
} elseif (isset($error)) {
echo $error; -
Passing YTD selection from a main query to a detailed query using RRI
Hi,
We have created two queries: one main query on an infocube for aggregated data, one detailed query on the feeding DSO for data at the level of sales document items.
Both queries show monthly and YTD (year-to-date) actual cost figures.
The user enters for instance the month of 05.2005 on the main query in a variable ZP_MONTH.
A user exit variable ZS_YTD is calculated so that the interval 01.2005 - 05.2005 is stored in ZS_YTD.
Revenues in the month are displayed in one column.
Revenues in the YTD period are displayed in another column.
Assume the data is displayed by document types.
Then the user should select the document type and perform a jump target (Goto) to the detailed query to see which sales document items are contributing to the total revenues behind the document type.
We have defined a ZS_YTD_2 variable on the detailed query. It is used in the field assignments in the RSBBS transaction to receive the 0CALMONTH selection (in our case 01.2005 - 05.2005). Then on the detailed query, we defined another userexit variable to capture the selected month based on ZS_YTD_2.
Our issue is that when the user goes from the main query to the detailed query, the variable screen of the detailed query is being displayed with the variable ZS_YTD_2 open and the user can even change the selection there.
Is it possible to remove the display of this intermediate variable screen?
Thanks.Well. If you unflag the variable for ready for input on the detailed query, then it is not possible for that variable to receive the period selected on the main query. Even worse, the query crashes with the message that the variable is not correctly defined.
Any other suggestion?
Thanks. -
Deny user from seeing/selecting from tables but allow access to certain view
Need some assistance. I have a database on SQL Server 2008 R2. Using windows authentication and a custom group, I control who can access the database and serve up the data via a web application.
I now have a requirement to allow users to connect to the data using Power Pivot, but do not want to allow users to see all tables/views, I want explicitly control what they see.
How do I lock everything down so that users can still view the data from a defined view but limit access to the other tables and views ?
In essence, my users should not be able to see/select from any of the tables or views except for a specific view that I want them to have access to.
ThanksIf the View and the Table are in the same database and have the same owner, then a user who has SELECT permission on the View does not require any permissions on the table.
See
Ownership Chains
David
David http://blogs.msdn.com/b/dbrowne/
http://blogs.msdn.com/b/dbrowne/ -
Is there any query to know the multiple users name from their ids?
is there any query to know the multiple users name from their ids?
Hi,
Goto TCode SUIM Select Users Select Users by Address Data
It will give you the users list
Regards,
Sankaran -
Get year from user selected month in field name
Hi BExperts,
I would your help about this problem on BI 7 :
At the opening of the query, user selects a month (for example 03.2007).
From this month, i have to indicate key figures on the selected month (03.2007) and key figures on the corresponding year (here 2007).
I'm using a variable in order to get the selected month (0I_CMNTH).
I don't know how to get the corresponding year (with a variable) ?
For example : user selects "03.2007", in the query i would have :
Period Key figure
03.2007 17
2007 38
Thanks for help.
Points will be assigned.
Cheers,
Vince.Hello,
I am not sure about the one you mentioned but this is another way which you can try by creating the customer exit variable V_YEAR under 0calyear characteristic and add the following code for gettting the previous year.
data: year(4) type n,
year1(4) type n.
when 'V_YEAR '.
if i_step = 2. "after the popup
loop at i_t_var_range into loc_var_range
where vnam = '0I_CMNTH'.
year = loc_var_range-low (4).
year1 = year - 1.
clear l_s_range.
l_s_range-low = year1.
l_s_range-sign = 'I'.
l_s_range-opt = 'EQ'.
append l_s_range to e_t_range.
exit.
endloop.
endif.
Maybe you are looking for
-
License for testing and production systems
Hi Experts Can any one help me out on implementing license in my B1 System. According to our contract we have licensed following user types: User Type Licensed AddOn Access License 25 Professional User 5 Software Development Kit - D
-
I have an app in my App Store under updates under purchased that I'd like to get removed from my phone. How do I do that?
-
How to convert oracle BLOB to String
Hi, I am working on an GIS project using Oracle database which stores the spatial data. When I read the polygon points data which is saved as BLOB type in database table and convert the BLOB to byte[], there is no problem. However when the data is co
-
You see: after company there is a vertical line Design is Fun..... This should not be added. It appeared when I used a sample version, but I don't know how to remove it... Anybody?
-
ERROR - The element 'MailboxSearchScope' in namespace has invalid child element 'ExtendedAttributes'
hi everyone, i'm using exchange server 2013 and write following code for getting searchable mailboxes and getting emails from these searchable mailboxes but i'm getting following error on "SearchMailboxes" function. Code: ExchangeService service = ne