Creating Views on multiple databases
In our database environment we have three databases Prod, Test, and Dev. Can anyone tell me if there is any value to ensuring that all three databases have exactly the same views on each of them all the time.(most views are fairly simplistic). Also is there an easy way to copy the views or tables from one database to the others quickly without rerunning the scripts on each database. Thanks.
Arjen,
I am a bit confused by what it is you need. It appears you may have Entity Object and View Objects mixed up. Entity Objects are one-to-one with database tables. So, for every table one Entity Object, and the other way around. Associations are, pretty much, one-to-one with foreign keys on the database. So, if two tables have a foreign key between them, the two Entity Objects will have an Association between them. In that respect, Entity Objects and Associations are usually 'strictly defined' by the database model.
The layer of View Objects and View Links is where you 'get design control' in the Business Components arena. A View Object can be based on zero, one or more Entity Objects. Viewlink, defining 'Master-Detail' relationships between View Objects (and NOT Entity Objects!!) can but don't have to be based on Entity Associations (i.e. foreign keys), but can be based on any attribute in the 'Master' view to any attribute in the 'Detail' view.
In this respect, your statement that you want to "make a master-detail between entity1 and view1" makes no sense. It sounds like you need to create a View2, and then make a View Link between View1 and View2.
Kind regards,
Peter Ebell
JHeadstart Team
Similar Messages
-
Create view from multiple days tables
Hi,
I'm having existing oracle db with daily stat data, tables strangely named data_mon, data_tue, data_wed.. For my batch processing I plan to use view with multiple day data, let say for last 5 days.
Not sure how better implement my sql statement, with those _mon suffixes to make it more or less dynamic.
I also never create View from multiple tables, so probably I can do something that will add fresh daily data and delete 5 days old data?
Will appreciate you comments on details and whole concept. I have prev sql server experience.
Thanks
Tuser12943718 wrote:
Hi,
I'm having existing oracle db with daily stat data, tables strangely named data_mon, data_tue, data_wed.. For my batch processing I plan to use view with multiple day data, let say for last 5 days.
Not sure how better implement my sql statement, with those _mon suffixes to make it more or less dynamic.
I also never create View from multiple tables, so probably I can do something that will add fresh daily data and delete 5 days old data?
Will appreciate you comments on details and whole concept. I have prev sql server experience.
Thanks
TChange the data model so you don't have 1 table for a day.
You just have a DATA table, and a column to denote the day of applicability.
Then you don't need a view, don't need anything dynamic, don't need to smash your head against a wall for a simple query ... etc. -
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. -
Creating Views on multiple entity-objects
Dear Forum,
Is it possible to make associations and lookups based on multiple entity-objects.
I made a custom view, say view1 based on two entity-objects, say entity1 and entity2.
I used some fields from entity1 and some from entity2. There's a 1 to 1 association between the index of entity1 and entity2.
Now I want to make a master-detail between entity1 and view1. I tried to make links and associations, but that didn't work.
Any ideas?
Kind regards,
ArjenArjen,
I am a bit confused by what it is you need. It appears you may have Entity Object and View Objects mixed up. Entity Objects are one-to-one with database tables. So, for every table one Entity Object, and the other way around. Associations are, pretty much, one-to-one with foreign keys on the database. So, if two tables have a foreign key between them, the two Entity Objects will have an Association between them. In that respect, Entity Objects and Associations are usually 'strictly defined' by the database model.
The layer of View Objects and View Links is where you 'get design control' in the Business Components arena. A View Object can be based on zero, one or more Entity Objects. Viewlink, defining 'Master-Detail' relationships between View Objects (and NOT Entity Objects!!) can but don't have to be based on Entity Associations (i.e. foreign keys), but can be based on any attribute in the 'Master' view to any attribute in the 'Detail' view.
In this respect, your statement that you want to "make a master-detail between entity1 and view1" makes no sense. It sounds like you need to create a View2, and then make a View Link between View1 and View2.
Kind regards,
Peter Ebell
JHeadstart Team -
Creat View from Multiple tables , Multiple Select
Hello Everyone ,
I have a question and am not sure if this the correct forum to post it .
I have two table studentTable and CourseTable which is each student take more than one course . 1:M
for example Student1 take 2 courses (C1 , C2).
Student2 take 3 courses (C1,C2, C3).
I need to create a table/View that contain student information plus all the courses and the score for each course in one row.
for example
Row1= Student1_Id ,C1_code ,C1_name ,C1_Score ,C2_code,C2_name ,C2_Score
Row2=
Student2_Id,C1_code, C1_name,C1_Score,C2_code ,C2_name ,C2_Score , C3_code,C3_name,C3_Score
and since Student 1 just took two courses , I should enter NULL in 'Course 3 fields'
My Struggle is in the insert statement
I tried the following but it show an error
Insert Into Newtable
( St_ID, C1_code,c1_name, C1_Score ,C2_code ,C2_name,C2_score,C3_code ,C3_name,C3_score)
Select
(Select St_ID from StudentTable)
(Select C_code,c_name,c_Score
from Coursetable,SudentTable
where course.Stid =Studet.stid)
(Select C_code,c_name,c_Score
from course ,student
where course.Stid =Studet.stid ),
(Select C_code,c_name,c_Score
from course ,student
where course.Stid =Studet.stid );
I'm fully aware that the New table will break the rules of normalization ,but I need it in this way for specifc purpose.
I tried also the PIVOT BY functionality but no luck with it .
FYI , I'm not expert in using SQL Syntax , I just know the basic.
I will be great full for any helpfull suggestions to try ,
thank you very much.First Table is Member table which Represent
Students Information
.The fields in this table are
member_sk (PrimaryKey), full_or_part_time, gender, age_at_entry, age_band_at_entry, disability, ethnicity,
widening_participation_level, nationality
Second Table is Modules table which include
the Courses' scores that Student took .
The fields in this table are
Module_result_k(Primary Key), member_sk(Foreign key to connect to Member table), member_stage_sk
,module_k(Foreign key to connect to Module table), module_confirmed_grade_src, credit_or_result
Third Table is
AllModuleInfo which is include
general information for each course .The fields in this table are
Module_k (Primary key), module_name ,module_code, Module_credit, Module stage.
The New table
that I will create has the following fields
member_sk (PrimaryKey), full_or_part_time, gender, age_at_entry, age_band_at_entry, disability, ethnicity,
widening_participation_level, nationality
" This will be retrieved from Member table"
Also will include
Module 1_name ,module1_code, Module1_credit, Module1_ stage, member1_stage_sk
, module1_confirmed_grade_src, credit1_or_result
Module 2_name ,module2_code, Module2_credit, Module2_ stage, member2_stage_sk
, module2_confirmed_grade_src, credit2_or_result
I will repeat this fields 14 times which is equal to Maximum courses number
that any of the students took.
//// I hope now my questions become more clear -
[ADF Help] How to create a view for multiple tables
Hi,
I am using Jdeveloper 11G and ADF framework, and trying to create a view to update multiple tables.
ex:
Table A has these fields: ID, Name
Table B has these fields: ID, Address
A.ID and B.ID are primary keys.
B.ID has FK relationship with A.ID
(basically, these tables have one-to-one relation)
I want to create a view object, which contains these fields: B.ID (or A.ID), A.Name, B.Address.
So I can execute C,R,U,D for both tables.
I create these tables in DB, and create entity objects for these tables.
So there are 2 entity objects and 1 association.
Then I create a view object based on B and add fields of A into the view:
If the association is not a "Composition Association",
when I run the model ("Oracle Business Component Browser") and try to insert new data, fields of A can't edit.
If the association is a "Composition Association", and click the insert button, I will get
"oracle.jbo.InvalidOwnerException: JBO-25030: Failed to find or invalidate owning entity"
If I create a view object based on A and add filed of B into the view:
When I run the model and try to insert new data, fields of B can't edit, no matter the association is or is not a composition association.
So... how can I create a view for multiple tables correctly?
Thanks for any advices!
Here are some pictures about my problem, if there is any unclear point, please let me know.
http://leonjava.blogspot.com/2009_10_01_archive.html
(A is Prod, B is CpuSocket)
Edited by: user8093176 on Oct 25, 2009 12:29 AMHi Branislav,
Thanks, but the result is same ....
In the step 2 of creating view object, I can select entity objects to be added in to the view.
If I select A first, and then select B (the "Source Usage" of B is A), then finishing the wizards.
When I try to create a new record in the view, I can't edit any properties of B (those files are disabled).
If I select B first, and then select A in crating view object, the result is similar ...
Thanks for any further suggestion.
Leon -
How do i create multiple databases on the same unix box?
Hello experts.
Please send me some guidelines on how to create multiple databases on the same unix box and how to configure their startups including listeners.
Please also, list me the possible precautions to takes especially if the existing database is a production one!
thanks very much for you reply
Best Regards
YogeerajHello,
I tried the following:
svrmgrl> startup nomount pfile=I:\d01\oracle\admin\cmttest\pfile\init.ora
then
svrmgrl> CREATE DATABASE cmttest
LOGFILE 'i:\d01\oracle\oradata\cmttest\redo01.log' SIZE
1024K,'i:\d01\oracle\oradata\cmttest\redo02.log' SIZE 1024K
MAXLOGFILES 32
MAXLOGMEMBERS 3
MAXLOGHISTORY 1
DATAFILE 'i:\d01\oracle\oradata\cmttest\system01.dbf' SIZE 50M REUSE
MAXDATAFILES 254
MAXINSTANCES 1
CHARACTER SET WE8ISO8859P1
NATIONAL CHARACTER SET WE8ISO8859P1;
Then when i try to run both databases:
svrmgrl> set instance cmttest
ORA-12500: TNS: Listener failed to start a dedicated process
===================
I am doing something wrong.
please help
Regards
Yogeeraj -
Error while creating materialized view which using database link
Helo!
I'm getting error "ORA-00942: table or view does not exist" when I want to create materialized view.
Details:
1. On destination database I create a database link:
CREATE DATABASE LINK SDATABASE
CONNECT TO MYUSER
IDENTIFIED BY MYUSERPASS
USING 'ORCL';
=> Command "SELECT * FROM TABLE1@SDATABASE" returns data normally!
2. On source database I create MATERIALIZED VIEW LOG:
CREATE MATERIALIZED VIEW LOG
ON TABLE1
WITH PRIMARY KEY
INCLUDING NEW VALUES;
3. Now, when I want to create MATERIALIZED VIEW on destination database:
CREATE MATERIALIZED VIEW TABLE1
REFRESH FAST
START WITH SYSDATE
NEXT SYSDATE + 1/1440
WITH PRIMARY KEY
AS SELECT * FROM TABLE1@SDATABASE;
...I get error "ORA-00942: table or view does not exist"!
How is that possible if command "SELECT * FROM TABLE1@SDATABASE" returns data normally?
Thanks,
VorancAnd, I'm using Oracle 10g.
Voranc -
Include or create a view in the database and use this view?
Well, I need to get related data of the main table from another related tables, so one way to do that is to use the Include method in Entity Framework to get this related data.
However, I am thinking in another option, create a view in the database and use this view in entity framework. In this way, I avoid the needed of the include, because I think that is expensive in resources. But I am no very sure about that.
I would like to know if the use of views on entity framework is a good idea to improve the performace or is better to use the include.
For example, if I use the include I have the advantage that I get only one the main record and all the related data I have in the navigation properties, so the info is more shorted.
Which is the advanteges and disadvantages of both methods to get related data in entity framework?
Thank so much.Hello ComptonAlvaro,
>>I would like to know if the use of views on entity framework is a good idea to improve the performace or is better to use the include.
If your view would use a Join syntax to query master-child relationship tables, it actually is similar with the Include() method which actually results a duplicate records from master table, you could check this
link for detail description.
>>Which is the advanteges and disadvantages of both methods to get related data in entity framework?
One visible difference is that records from Views are not editable by default(if you want edit them, you could refer to this
blog).
In your case, my suggestion that you could use the lazying load which will load the matter table once and disable the trace if you only need to display data.
Regards.
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click
HERE to participate the survey. -
Create View from Database Links - Question
Question
I'm missing something simple.
I'm trying to create a view, from a Database Link.
CREATE VIEW view_name
AS SELECT a.*
FROM schema.tablename@dblink a;
When I run this in the SQL Commands window.
I get this error message.
ORA-00933: SQL command not properly ended
What am I missing? Any help is appreciated...<i>CREATE VIEW vw_name
AS SELECT a.*
FROM [email protected] a;
</i>
<br>
1) User (schema) which is creating view must have proper db_link to source database. For that try this for testing purpose:
select 1 from [email protected]<br>
If this fail then db_link is not ok! This step is absolute must to go any further step to!!!
<br>
2) when db_link is set, then your view should be named as:
CREATE VIEW vw_name
AS SELECT *
FROM <b>schema_name</b>.[email protected];<br>
please pay attention to "schema_name", because from remote side every table is in some schema so it really need declaration of owner schema.
<br>
Hope this helps... -
Create View table with multiple table
I want to create View table with relation with multiple tables.
for ex
table 1
mrnno
mrnqty
table 2
mrnno
issqty
table 3
mrnno
retqty
want to create view table where i can see the sum (mrnqty), sum(issqty),sum(retqty) group by mrnno
sandyHi
CREATE OR REPLACE FORCE VIEW my_view AS
WITH t1 AS
(SELECT mrnno,
SUM(mrnqty) sum1
FROM table_1
GROUP BY mrnno),
t2 AS
(SELECT mrnno,
SUM(issqty) sum2
FROM table_2
GROUP BY mrnno),
t3AS
(SELECT mrnno,
SUM(retqty) sum3
FROM table_3
GROUP BY mrnno)
SELECT mrnno,
sum1,
sum2,
sum3
FROM t1,t2,t3
WHERE t1.mrnno = t2.mrnno
AND t1.mrnno = t3.mrnnoCheers
Ben
http://www.munkyben.wordpress.com
Don't forget to mark replies helpful or correct ;) -
Hi,
I need a couple of hints. I would like to create multiple
databases for my installation of Oracle 9i. Just running dbca
didn't work. Are there any steps I have to take to prepare the
system before running dbca?
I was able to install one database during the installation
without problems, but now I need to create some more.
Any help would be truly appreciated.
Thanks a lot in advance,
IngoWhat is the host system ? O/S ? When dbca didn't work what were
the circumstances ?
Hi,
I need a couple of hints. I would like to create multiple
databases for my installation of Oracle 9i. Just running dbca
didn't work. Are there any steps I have to take to prepare the
system before running dbca?
I was able to install one database during the installation
without problems, but now I need to create some more.
Any help would be truly appreciated.
Thanks a lot in advance,
Ingo -
How to create linked server to multiple database on same server?
Hi Experts
I want to create linked server to multiple databases on the same server.
I have 2 database servers (ServerA and ServerB) and want to create linked server on ServerB to link multiple databases on ServerA).
I have admin right on ServerB.
I don't have admin right on ServerA but have different accounts to access on each databases on ServerA.
After I created one linked server object to a database, I cannot create another linked server object for another database as it has already used the server name which is ServerA.
Please advise.
Thanks.EXEC sp_addlinkedserver 'ServerADB1', '', 'SQLNCLI', 'ServerA', @catalog = 'DB1'
EXEC sp_addlinkedserver 'ServerADB2', '', 'SQLNCLI', 'ServerA', @catalog = 'DB2'
etc.
Please look up the details for sp_addlinkedserver as I typed this from memory.
I can certainly see a point in having one linked server per database, as then you don't have to hardcode the database name in the queries, and the linked-server definitions can be changed if the database name changes.
Erland Sommarskog, SQL Server MVP, [email protected] -
Multiple database users, ORM, entity framework, best practices
Hello everyone!
You've already helped me several times, however I must ask for an advice once more.
I was assigned to develop .NET application with Data Access Layer and I've decided to use Oracle Database Software to provide sample data.
As I'm absolute novice considering creating DAL I'd be grateful if you can examine my plan in terms of security and reliability:
My database:
1) I've created database with sample tables and relations between them. All tables belongs to databaseAdmin.
2) I've created HR and Manager database users and granted them some privileges on certain databaseAdmin's tables. My intention is to reduce access to unnecessary tables. If my application user want to make some changes to Customers table it should be enough to connect to database as HR.
And now I'd like to map my database using Entity Framework in my application. And that's where I have a problem:
-If I create Entity Model basing on databaseAdmin tables I get perfect model, however every Entity SQL query would be executed on behalf of databaseAdmin, which breaks my idea of hiding unnecessary tables.
-If I create Entity Model for HR and Manager users, my models could overlap on tables that both users have access to and no connection between tables would be generated (as from their point of view those tables are just some tables that belong to databaseAdmin)
Could you help me with this deadlock? Or maybe my assumptions about multiple database users are incorrect? Please, bear in mind I'm a novice.
I was trying to find a solution in web, and there're tons of data discussing technical aspects of Entity Framework etc., but not so many documents about conceptual model of database.hi Michael,
Thanks for you posting!
Sorry for I am not totally understanding your issue. Maybe two points need your confirm:
1. I confuse with the "Service controller"? IS your meaning MVC controller? Or ServiceController(http://www.codeproject.com/Articles/31688/Using-the-ServiceController-in-C-to-stop-and-start
2.whether The type of ID in the model is match to the database ? In other words, Is the type of IDin .edmx matched to the database?
By the way, it seems that this issue is more related to EF. You could post this issue on EF discussion for better support.
Thanks & Regards,
Will
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click
HERE to participate the survey. -
Multiples Databases in a single Report
Hi all experts...
How I can create a parameter to chosse multiples databases... In a single report!
regardsWagner,
If you have CR Server installed on your network, you can use the Business View Manager to create a Dynamic Data Connection.
As soon as you add the Business View to your report as the data source, a choose database parameter will be added to your report automatically.
Also, if your BIG idea works out, please post it. We all love new ideas. Especially when they work.
Jason
Maybe you are looking for
-
It's only a problem on my home desktop and isn't a problem with IE. It must be an option I can change but I can't find it. Please help.
-
HTML Preview for Financial Reportings Books
Hi all, im creating a book in financial reporting. The problem i have found is that when i open the book in html preview i can't expand members. It seems that financial reporting doesn't let you to expand members of its reports when you are in html p
-
Error:- No server was available to process the request. Please try again la
Hi All, I have created a report in deskI and trying to execute it through WebI on a large database, but it gives the below mentioned error after almost 30 min. Error:- No server was available to process the request. Please try again later. (Error:RFC
-
Import Access and Excel datafile into Oracle
Dear SQL Expert: Could you hint me how to import Access and Excel datafiles into a newly install oracle database. An outline doc on procedure would be helpful. Thanks, user607670.
-
I am working on a small pocket book. Any suggestions for a font and size to get the most words on a page with high readability? Joel