Command to call Multiple Databases
I have command that runs that removes admin rights for users in a database then I run another script that adds admin rights afterwards.
The script to remove admin rights is:
Get-Mailbox -ResultSize Unlimited -Database "MailboxDatabase4" | Remove-MailboxPermission -user "admin" -AccessRights FullAccess -InheritanceType All
The script to add admin rights is:
Get-Mailbox -ResultSize Unlimited -Database "MailboxDatabase4" | Add-MailboxPermission -user "admin" -AccessRights FullAccess -InheritanceType All
I Have 6 databases, therefore I have to run the scripts 12 times each day. is there any way of calling all the databases in one script so that I only have to run one script for all the databases to remove admin rights, then another script to add admin rights.
therefore not having to do it for each individual database.
Hi Tobias,
To run script on bulk objects, please refer to the script below to start:
$database="MailboxDatabase1","MailboxDatabase2","MailboxDatabase3","MailboxDatabase4"
Foreach($data in $database){
Get-Mailbox -ResultSize Unlimited -Database $data | Remove-MailboxPermission -user "admin" -AccessRights FullAccess -InheritanceType All
To use loop in powershell, please refer to this article:
Basics of PowerShell Looping: Foreach
If there is anything else regarding this issue, please feel free to post back.
Best Regards,
Anna Wang
Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Support, contact [email protected]
Similar Messages
-
Multiple calling logical database ADA
Hello,
I need to call logical database ADA two times in my program. I use calling logical database using LDB_PROCESS function module. I need to call LDB for depreciation areas 01 and 60. If I call second time, I get exception LDB_NOT_REENTRANT. I found, that for multiple calls of LDB, there should be LDB_PROCESS_INIT subroutine in logical database proram. In this case, program is SAPDBADA and in this program, LDB_PROCESS_INIT is missing.
Could you pls. help me, how to call ADA logical database two times?
Thanks®ards,
JirkaThe exception LDB_NOT_REENTRANT means: The logical database is not prepared to accept several successive calls within a transaction. So obviously you can't use LDB_PROCESS for your purpose.
Perhaps your goal is possible if you use a sequence of commands
GET <ldb_node_1>.
GET <ldb_node_1> LATE.
GET <ldb_node_2>.
GET <ldb_node_2> LATE.
etc...
where ldb_node_1, ldb_node_2, etc... are some nodes included in logical database ADA. As I am not familiar with this particular LDB I can't tell which nodes are required to achieve your goal. -
How to access multiple database present in single instance
Hi Team,
In oracle 11.2, can there be multiple databases in an instance??? In one of our environment, I could see multiple databases in an instance. Could you please help me in giving the data dictionary or query to access those databases?
Actually, querying v$database, I could see only one database which is same as instance name. But in inventory, there are multiple database in an instance?
I am still not exactly clear about this. Can someone help me with this?
Thanks!
VidhyaIn Oracle one instance manages one (1) database. A database consists of multiple *schemas*.
Other vendors erroneously call a schema 'database'.
So, no, you didn't see multiple databases.
There is also one datadictionary, consisting of a set of views.
All views beginning with dba_ list the entire database, all schemas.
All views beginning with all_ list the objects you have access to.
All views beginning with user_ list your own objects.
The view DICT show you the contents of the datadictionary.
Oracle also has online documentation at http://docs.oracle.com
From your question it is clear you should read the document called the 'Oracle Concepts Manual'.
You can find all documentation for 11gR2 here Oracle Database Online Documentation 11g Release 2 (11.2)
Too many people here don't make any effort to read it. This is probably the reason why you got no response.
Sybrand Bakker
Senior Oracle DBA -
Can join queries in Oracle 8i and above span multiple databases
Hi,
In Oracle 8i and above, can join queries span multiple databases??
For eg., I have two databases A and B, and say database A has table A_T and
database B has table B_T. Assume that both the databases are on the same
server.
Can I run a join query from my application using OCI calls that spans across
tables from multiple databases, namely, A_T and B_T?
My query probably looks like this - Select * from A.A_T, B.B_T;
Thank you,
SashiIn Oracle 8i and above, can join queries span multiple databases??
For eg., I have two databases A and B, and say database A has table A_T and
database B has table B_T. Assume that both the databases are on the same
server.
Can I run a join query from my application using OCI calls that spans across
tables from multiple databases, namely, A_T and B_T?
My query probably looks like this - Select * from A.A_T, B.B_T;If you create a database link from database A to B your SQL would look something like this:
select * from A.A_T, B.B_T@dbB where A.A_T.PK = B.B_T.PK@dbB
The Oracle manuals should have the information you need on creating a database link. -
Creating user in multiple databases
Hi All,
I want to create an user in multiple Databases (100+)
Could any one can share the script .
Oracle DB Version - 9.2.0.6,9.2.0.7 & 10.2.0.2
Os - Hp Unix.
Kindly help me out from this.
Thanks,
Ram.895188 wrote:
Hi
Thanks a lot for your reply
I can follow your command but my requirement is to do the same in all 100+ databases which is a pain ful proces, So looking for script to create an user in all databases in one shot.
You need to connect to each DB; one at a time.
Realize that "script" is Operating System dependent & you decided not to share your OS with us.
We had an common server which can able to connect all the databases individually, by using the TNS Entries.
I am glad you have this since it will be needed to complete your task. -
Multiple database updates vesus Tansaction
Hi,
I need some help from you great minds. Here us what I am trying to accomplish:
I have a message driven bean which does a multiple update calls to an Oracle database.
I want to commit all the db updates only at the end (after all update calls execute
okay) and if there occurs any problem in any of the update calls, I want to rollback
all the previously successful update calls I have already made. I am using container
managed transaction via a mdb.
I tried to use UserTransaciom.setRollbackOnly() call but that did not completely
help. This call rolled back the message altogether. All I wanted to do is, if
there occurs any error during a database update, rollback just the database changes
and just throw away the message. Is there a way I can just rollback the database
changes? Any suggestions?? please. Thanks
If I understand correctly what you want to do, is the purpose to do some task or run some script in multiple databases on the same server?
If so, this is done easily by listing the database (sids) in a file and reading the file in a loop statement.
In my case, I simply create a file on the server called localsids. I keep this in /var/opt/oracle directory.
Then, in my script, I set:
SIDFILE='/var/opt/oracle/localsids'
NEWPASS=`cat $HOME/.xlh/sys`
# This loop reads through the 'sidlist' and then looks for a password
# stored in a separate directory for each sid, but if individual
# directories do not exist, then it uses the standard system password.
# It then opens a sqlplus session for each sid (as it loops through the
# sidfile and executes some sql statement(s), or executes a sql script.
cat $SIDFILE | while read SID
do
ORACLE_SID=$SID
export ORACLE_SID
echo $SID # this is only for my own verbose purposes
sqlplus -s system/manager@$SID <<EOF > /tmp/chg_passwd_${SID}.sql
alter user system identified by $NEWPASS
alter user sys identified by $NEWPASS
EOF
done
exit
# In the above example, i am changing the sys and system passwords for all databases listed in the localsids file.
Hope this helps...
ji li
Message was edited by: ji li to simplify the example...
I have simplified the above example to hardcode the system password into this script, however, normally I would never do this in real practice. This is just as an example to simplify how to run a loop to run a common script or sql statement in each database. -
Running the same sql script in multiple databases
Hello,
What is the method to run the same sql script in multiple databases? I want to write a unix script that would select from different databases and run a sql/plsql script in those different databases. What are the ways to write such a unix script? Thank you in advance.Just have a parameter which takes in the oracle connection parameters and use it in your sqlplus script with your shell script.
Your sqlplus script can have a procedure/function call or an anonymous block;
Then have a wrapper script to call the original script with different connection parameters. Hope this helps. -
Calling multiple DB functions in same analysis throws Invalid Identifier
Hi all,
I am trying to invoke multiple database functions using evaluate function in a report, and as soon as I add the second function, I keep running into the below error. As you all know we could call two functions in a single select statement, so I would assume it to work the same way in BI.
State: HY000. Code: 10058. [NQODBC] [SQL_STATE: HY000] [nQSError: 10058] A general error has occurred. [nQSError: 17001] Oracle Error code: 904, message: ORA-00904: : invalid identifier at OCI call OCIStmtExecute. [nQSError: 17010] SQL statement preparation failed. (HY000)
Has anyone ran into this issue before ?
Thanks,
-A.Y.veeravalli wrote:
Hi Amith,
Can you try with only second funtion (excluding first evaluate) and with other columns? to make sure your 2nd evaluate function is fine.Yes, they all work if used individually. Combining each other is causing the issue.
As a work around I am writing a package to merge everything together for now, but it would be nice to have this feature.
One thing to note is if you actually take the physical sql and run it against database, it works just fine. -
Calling Multiple BAPI's - LUW problem
Hi All,
I am calling multiple BAPI's in a program. After Executing First BAPI - the database is updated after the commit work . but for the second BAPI the database is not commited.
Any Suggestions.
Thanks in Update.
Rk.Hi,
1) Are you getting any error messages after the second call?
2) Are you calling the COMMIT WORK BAPI after each call, or just once after calling the BAPI twice?
3) Is the second BAPI call dependent on the first BAPI call in terms of data?
Provide more info on the BAPI you are calling and a code snippet of the program structure, the more information you provide, the more information you will get back from the forum.
Regards,
Chen -
Calling multiple URL in call browser
hi
i am having internal table having a multiple Url . each row consists of different URl.
i am calling the call browser functional module in Inside the Loop .
what i am geting is , when the first record ( URL) gets generated . it will call the Browser . sms sent and its not calling the second record even though its in loop.
what has to do. any parallel processing / asynchronous processing posibleI was browsing forums and your problem seem to be stuck in my brain. It keeps coming back again and again :-).
Anyways, I find out that instead of using CALL_BROWSER, if you can use the execute method of cl_gui_frontend_services, it will work. Just pass internet explorer exe file path in 'APPLICATION' parameter and you url in 'PARAMETER' parameter.
However there is one problem and that is how to get the filepath for internet explorer exe file. On most PCs it will be like C:\Program files\Internet Explorer\iexplore.exe' , so you can hare code this. OR you can read it from registry as per the following
DATA: kstr TYPE string, vstr TYPE string,
convstr TYPE string.
kstr = 'SOFTWARE\Classes\Applications\iexplore.exe\shell\open\command'.
CALL METHOD cl_gui_frontend_services=>registry_get_value
EXPORTING
root = cl_gui_frontend_services=>hkey_local_machine
key = kstr
IMPORTING
reg_value = vstr
EXCEPTIONS
get_regvalue_failed = 1
cntl_error = 2
error_no_gui = 3
not_supported_by_gui = 4
OTHERS = 5 .
IF sy-subrc <> 0.
WRITE:/ 'registry read error subrc=', sy-subrc.
EXIT.
ELSE.
TRANSLATE vstr USING '% 1 '.
CONDENSE vstr.
ENDIF.
Once you have explorer file path in VSTR, can can call the execute method as following.
Assumption: ITAB-STR is of type string and contains url like 'http://www'google.com' etc.
LOOP AT itab.
CALL METHOD cl_gui_frontend_services=>execute
EXPORTING
application = vstr
parameter = itab-str
EXCEPTIONS
cntl_error = 1
error_no_gui = 2
bad_parameter = 3
file_not_found = 4
path_not_found = 5
file_extension_unknown = 6
error_execute_failed = 7
synchronous_failed = 8
not_supported_by_gui = 9
OTHERS = 10 .
IF sy-subrc <> 0.
WRITE:/ 'Error in EXECUTE, subrc =', sy-subrc.
ENDIF.
ENDLOOP. -
Discoverer Reporting Solution for Multiple Databases
I have to build oracle discoverer reports (single point of access) for four different applications. Each application is having separate databases. So whether i should create separate EULs for each applications (in respective databases) or Should i create a single EUL in any one of the databases and then use db links to connect rermaining databases (for reports from the other applications).
Can u suggest me which method will work good if you see the performace?. I need a dingle point of access for all the discoverer reports.
The worksheets need to be deployed with oracle portal for access of reports in a single click. Is there any way to pre configure the db credentila for each worksheet...?Hi
My replies below make the assumption that you are not allowed to do any ETL and therefore the data from each database has to be pulled as is. If you do have ETL capability the situation changes dramatically.
In addition to what Sharon has said the cost based optimiizer will have a difficult job rewriting your query efficiently if you use database links, and if you attempt to have queries with some tables from one database and some from another the optimizer will not work at all. I mean. How could it? How could the optimzier in database A know anything about the statistics in databases B, C or D? Wherever the EUL is, that is where the driving optimizer will be so choose wisely obi-wan :-)
For me it's more about user needs than IT needs. If the business has a need to combine data from multiple databases then having a single EUL with database links would be a necessity. However, if they really are disparate systems with nothing in common such as say having Peoplesoft HR in one and E-Busines Suite Inventory in another with perhaps an in-house tracking system in another then I would look at having separate EULs, one in each.
Having one EUL across non-related systems means you have to mix users and roles and can be hard to manage. It actually becomes messy when just two databases are involved never mind four. So even though you might think it is more difficult to maintain 4 EULs, if the objects really are different and you have differing roles and usernames it actually will probably be simpler. They will be simpler to backup, simpler for exporting and importing and it will be faster for Discoverer to maintain workbooks as there will be fewer of them. Plus your system will have access to its local optimzier thereby ensuring the SQL is efficient.
If you are going to use one EUL you need to start out on a sound foundation. This means using libraries to control access too business areas and workbooks. You'll need to adopt some simple naming standards to keep things separate and manageable. I wrote a paper about libraries a few years ago and it is available free of change here on my website: http://ascbi.com/downloads.htm. The paper is called Discoverer Libraries - a Concept.
Best wiishes
Michael -
I have a requirement in which I will need to use the same classes to
access different databases. In other words, let's say I have a Person
class. I'd like to use the enhanced Person class to pull people from a
SQL Server database, and an Oracle database.
The documentation mentions that you can access multiple databases by using
different kodo.properties files with different names. However, it doesn't
mention using different mappings, that I can see.
What I'm thinking I could do is extend kodo.jdbc.meta.FileMappingFactory.
Then I could have a .mapping file for each different database. My
extension would just need to know to access *.sqlserver.mapping or
*.oracle.mapping for instance.
Is this plausible? If so, any hints on extending FileMappingFactory? How
is that guy determining the name of the mapping file? Can I simply
override a method?
I'm hoping this will work, so that I don't have to create a
SQLServerPerson and an OraclePerson. Any ideas appreciated.
Thanks,
SteveOk, in answer to my own question, I'm providing the following which I hope
Abe or Stephen will look at, and tell me this won't break everything.
It seems that jdbc-class-ind is only read at the base level, and thus I
couldn't add an "indicator" for each of my subclasses. So, as I wrote
previously, I needed a way to read my jdbc-class-ind-value in my .mapping
file for each class. Here is the code I came up with:
<code>
public class MyFileMappingFactory extends FileMappingFactory {
JDBCConfiguration myConfiguration = null;
static Logger log = Logger.getLogger(MyFileMappingFactory.class);
public synchronized void readMapping(ClassMetaData type,
MappingInfoRepository repos) {
super.readMapping(type,repos);
try {
String[] persistentClasses =
myConfiguration.getPersistentClassesList();
MappingRepository mappingRepos =
myConfiguration.getMappingRepository ();
for (int i=0;i<persistentClasses.length;i++) {
String className = persistentClasses;
try {
Class clazz = Class.forName(className);
ClassMapping mapping = mappingRepos.getMapping(
clazz, clazz.getClassLoader(), true);
mapping.addExtension(
"jdbc-class-ind-value",
mapping.getMappingInfo().getAttribute("jdbc-class-ind-value"));
catch (Exception e) {
log.error("Could not set jdbc-class-ind-value for class '" +
className + "'.");
catch (Exception ex) {
public void setConfiguration(Configuration conf)
myConfiguration = (JDBCConfiguration) conf;
super.setConfiguration(conf);
</code>
I did a lot of introspection using JBuilder as well as the Javadoc to
figure out what I needed to call. Basically, I need to have
kodo.PersistentClasses set in my config file, and I added an attribute to
the .mapping jdbc-class-map element. Finally, my kodo.properties has to
point to my custom MappingFactory.
It all seems to work, but I wanted to verify with the experts I'm not
breaking anything. I had hoped to figure out how to put an <extension> in
the .mapping file so that it stood out even more as being "custom code",
but could not figure out how to read such an element.
Steven Kouri wrote:
I think you've answered my question, but it doesn't help my problem. I
actually did both: I loaded the static classes in my code as well as used
the kodo.PersistentClasses property. Neither helped this situation.
The reason it seems is when the fromMapping() gets called. It only got
called after calling execute() on my query. Thus, the rest of my mappings
hadn't been loaded yet. I put a breakpoint in fromMapping(), and here was
my stack trace:
execute()
executeWithArray()
executeWithMap()
internalCompile()
getMetaDatas()
getMappings()
getMapping()
getMappingInternal()
getMapping()
getMappingInternal()
intialize()
fromMapping()
So, I need to figure out a way to get my code to read all the mappings
before I do an execute(). I think. :) I'll investigate further unless
you can give me a pointer in the right direction.
Thanks!
Steve
PS: 1pm? 1PM? I'm here before 7am! But then, I usually leave at 4pm. :)
Abe White wrote:
Is the .mapping file preparsed, or is it only accessed when a class is
requested from the datastore?
We only resolve mappings when the classes are actually used. Have you
listed all your persistent classes in the kodo.PersistentClasses
configuration property, as suggested by the documentation for
MetadataValueIndicator?
PS: It's 5:37pm on a Friday. I'm going home. You should too! :)
When you decide to start work at 1pm, you tend to stick around a little
later. -
Hi
In development environment I have many branches(copies) of a database.
For every change (ddl, dml) i have to login every database manually to execute statements, Is there a client tool that support multiple database update or if any expert ever make a customized routine for that?
And ideally as i have different named branches i wish i can define the scope of change too i.e. change execute on databases of "abc" & "pqr" branches only.
WishesIf I understand correctly what you want to do, is the purpose to do some task or run some script in multiple databases on the same server?
If so, this is done easily by listing the database (sids) in a file and reading the file in a loop statement.
In my case, I simply create a file on the server called localsids. I keep this in /var/opt/oracle directory.
Then, in my script, I set:
SIDFILE='/var/opt/oracle/localsids'
NEWPASS=`cat $HOME/.xlh/sys`
# This loop reads through the 'sidlist' and then looks for a password
# stored in a separate directory for each sid, but if individual
# directories do not exist, then it uses the standard system password.
# It then opens a sqlplus session for each sid (as it loops through the
# sidfile and executes some sql statement(s), or executes a sql script.
cat $SIDFILE | while read SID
do
ORACLE_SID=$SID
export ORACLE_SID
echo $SID # this is only for my own verbose purposes
sqlplus -s system/manager@$SID <<EOF > /tmp/chg_passwd_${SID}.sql
alter user system identified by $NEWPASS
alter user sys identified by $NEWPASS
EOF
done
exit
# In the above example, i am changing the sys and system passwords for all databases listed in the localsids file.
Hope this helps...
ji li
Message was edited by: ji li to simplify the example...
I have simplified the above example to hardcode the system password into this script, however, normally I would never do this in real practice. This is just as an example to simplify how to run a loop to run a common script or sql statement in each database. -
[ask] Multiple database for a user
Hi,
pardon for my very basic question since i'm new in database world. Currently I've been playing with XE and I cannot find a complete documentation on the subject, therefore I venture myself to ask some basic tasks of XE, such as:
1. Can a user have multiple database (or schema) or only 1?
2. If it can have multiple database, how can them be viewed?
3. How can I delete one of them if no 1 is true?
4. How can I delete a table?
5. Where can I find a thorough documentation on XE besides tutorial?
Best Regards,
Joeuser11357901 wrote:
Hi,
pardon for my very basic question since i'm new in database world. Currently I've been playing with XE and I cannot find a complete documentation on the subject, therefore I venture myself to ask some basic tasks of XE, such as:
1. Can a user have multiple database (or schema) or only 1?User infact IS a schema , and so schema IS user. They don't own the database;they belong to only one database,although they could
perform some actions on other databases
2. If it can have multiple database, how can them be viewed?You can access objects on remote database B with the user from database A by using database links
3. How can I delete one of them if no 1 is true?N/A
4. How can I delete a table?If using SQL, then DROP command is the one you want. DELETE command is used to delete row/s from a table, not to delete table
5. Where can I find a thorough documentation on XE besides tutorial?oracle.tahiti.com would be the best choice
>
Best Regards,cheers -
Jnlp file called multiple times
We're trying to pass HTTP parameters to our JNLP file (which is created by a .jsp file). When we run webstart from the command line (or a a web page), it seems like the JNLP file gets called multiple times. The first time our parameters are there, after that they are not. Why does webstart call the JNLP file multiple times? Has anyone else seen this.
We're running Tomcat 4.x on Linux.
From the command line we typed:
javaws "http://localhost/helloWorld.jsp?hello=1&world=2"
Tomcat Output:
DEBUG: hello=1&world=2
DEBUG: null
DEBUG: null
DEBUG: null
DEBUG: null
DEBUG: null
DEBUG: null
DEBUG: null
JSP File:
<!DOCTYPE html PUBLIC
"-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<%@ page contentType="application/x-java-jnlp-file" %>
<?xml version="1.0" encoding="utf-8"?>
<jnlp
spec="1.0+"
codebase="http://localhost"
href="http://localhost/helloWorld.jsp">
<information>
<title>Hello World</title>
<vendor>Nobody</vendor>
<application-desc>Hello World Application</application-desc>
</information>
<resources>
<j2se version="1.3+"/>
<jar href="lib/helloWorld.jar" main="true"/>
</resources>
<application-desc main-class="test.HelloWorldApp"/>
</jnlp>
<% System.out.println("DEBUG: " + request.getQueryString()); %>
Hello World Source:
package test;
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
public class HelloWorldApp {
public static void main(String[] args) {
JFrame frame = new JFrame("Hello World");
frame.getContentPane().add(new JLabel("Hello World", JLabel.CENTER), BorderLayout.CENTER);
frame.addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent e) {
System.exit(0);
frame.setSize(200,150);
frame.setVisible(true);
}I am seeing this exact same problem, also creating the JNLP via a JSP. Any input would be greatly appreciated.
Maybe you are looking for
-
HP Officejet 4500 Ethernet / Wifi Driver Problem (blank fields) with Office 2013
Hi, I have an Officejet 4500 (Ethernet) and I have exactly the same problem as lots and lots of HP Printer owners! Everytime I try to print on Office 2013 + Win 8 64-bit, the Printer window comes with strange "Asiatic" symbols, and not the original l
-
Why does my iPad (3rd Gen.) keep turning itself on and off?
I currently have my 3rd generation iPad plugged into the wall charger. It has been plugged in since yesterday morning and is still going through the same routine: on, off, on, off...HELP! I have tried to reset it, but it won't respond; the screen jus
-
Convert Scribble fill to line..???
Hey there!! Does anyone know how to convert the scribble fill (effect>stylize>scribble) to a line so that way I could change the brush of the fill-- not the outline Thanx x
-
If WP7.xap app will be updated to WP8.xap on WindowsPhone 8 device ?
Hi I have an quesiton. Do you know what will happen when some user with Windows Phone 8 device have already installed 7.x XAP and then someone at dashboard will add 8.0 XAP (supporting Windows Phone 8) by "add new" option. Is the user who already has
-
Are there any sport armbands available for the iphone 4 yet??
i've been looking all over. The only ones that i see specifically for the iphone 4 are from Belkin and they're not available yet..