Method and apparatus for preserving dependancies during data transfer and replication

Database objects, having interdependent relationships, are transferred for replication from a publisher to a subscriber in the order of a topological sort using a depth first search algorithm. When the depth first search algorithm attempts to enumerate all outgoing edges (dependencies) of a given node (database object), a request is made to begin an atomic transaction and then a temporary copy (e.g., via a T-SQL command) of the node/database object is created under a different name. The temporary copy is used to store dependency information that could otherwise be impaired by the replication process. Dependencies amongst database objects are thus preserved during the replication process through use of the temporary copy, as well as by transferring the database objects according to the topological sort order.

FIELD OF THE INVENTION

The present invention relates generally to the field of data replication and data transfer, and more particularly to an elegant method and apparatus for preserving data dependencies during data replication and data transfer.

BACKGROUND OF THE INVENTION

With the rise of computer automation, data processing, manipulation and its use have become fundamental aspects of a multitude of everyday activities. Often, it is advantageous to replicate or transfer larges stores of data, so that, for example, the data can be found in more than one network location. Replication may ensure that a corruption event suffered at one location does not cause information loss, because the data can be recopied from an uncorrupted location. Similarly, data transfer may facilitate data reporting from a new location and, consequently, to more than one group or cluster of computer users.

The integrity of data generated via replication or transfer, however, is often compromised by the loss of data dependency information, particularly, though not exclusively, when the database being copied or transferred conforms to the relational data model. As is well known in the art, the tables, columns and views that may characterize a relational database are often interdependent, and these data dependencies are required to accurately extract the information contained in a database. Therefore, when transferring object schemas such as tables, views, functions, and stored procedures from one database to another, it is necessary to ensure that that the objects are transferred in an order that does not violate their interdependencies. For example, if a view “V1” is dependent upon a view “V2,” which in turn is dependent upon a table “T1,” it is necessary to transfer the objects in the following order: T1, V2, V1. Otherwise, an object, dependent upon another, will be transferred without information that is necessary to define the object, leading to errors. Furthermore, even if database objects are transferred in the correct order, dependency information will often be lost during data transfer as a result of the deletion and recreation of database objects that other database objects are dependent upon. In the above example, even if “T1” is correctly transferred before “V2,” the deletion and recreation of “T1” attendant to the replication/transfer process may impair in formation that reflects the dependent relationship between “V2” and “T1.”

Thus, there is a need for a method and apparatus for preserving data dependencies during data replication/transfer that both ensures data is transferred in the correct order and addresses the problem of deletion and recreation of database objects that other database objects are dependent upon.

SUMMARY OF THE INVENTION

The present invention satisfies this need.

One embodiment of the present invention resides in a method for transferring data in a computing environment. The first step of the method is opening a temporary database transaction and creating a temporary copy of at least a first database object of a plurality of database objects. The database objects are contained in a database stored on a storage medium. The database also contains a second database object that is dependent upon the first database object. The database also contains at least a third database object, where the first database object is dependent upon the third database object.

The second step of the method is initiating a transfer of the first database object using the temporary copy of the first database object. This transfer of the first database object occurs before a transfer of the second database object and after a transfer of the third database object.

The third step of the method is terminating the temporary database transaction.

In accordance with another aspect of the present invention, the method may also include the step of performing a topological sort of the plurality of database objects. The topological sort ensures that the transfer of the first database object occurs before the transfer of said second database object and after the transfer of the third database object. The topological sort may be a sort resulting from a depth first search of database objects.

One advantage of the present invention is that it provides a way of replicating and transferring data while preserving data dependency information characterizing the data.

Further advantages of the present invention should become apparent from the detailed description below.

DETAILED DESCRIPTION OF EMBODIMENTS

Definitions

As used herein, the terms “source” or “publisher” refer to a computer or database from which data is copied or transferred. The terms “destination” or “subscriber” refer to a computer or database to which such data is transferred.

Data Preparation

The present invention is particularly useful for preserving data dependencies when transferring relation database data, though by no means is it limited such data transfer. In accordance with an embodiment of the present invention, prior to data transfer, the interrelated data of a relational database is first represented in a computer environment by a “Digraph” or “Directed Graph” data structure.

“Digraphs” and “graphs” are data structures known in the art that can be represented in a variety of computing environments. A “digraph” is a specific type of “graph.” Informally, a “graph” is a computer data structure that can be thought of as a set of finite points connected by lines. A “digraph” or “directed graph” can be thought of as a set of points connected by arrows. A “digraph” is thus a computer based data structure that allows the retention of information reflecting not only the existence of a relationship between entities, but also any “direction” associated with such relationship (e.g., identifying which entity is a parent and which is a child).

A digraph can also be expressed as specific type of graph in a more formal mathematical manner. Formally, a graph is a pair (“N”, “E”) where N is a finite set whose elements are called “Nodes”, and “E” is a set of subsets of “N” of order two representing relationships among pairs of nodes. The elements of the set E are called “edges.” The set “N” can be denoted {n1, n2, . . . nn}, while the set “E” can be denoted {(ni, nj), (nk, ni) . . . ).

For example, a graph may have seven nodes, “1,” “2,” “3,” “4,” “5,” “6,” and “7.” In that case, the set of nodes “N”={1,2,3,4,5,6,7}. Assume also that node “1” is related to both nodes “2” and “3,” that node “2” is related to both nodes “4” and “5” and that node “3” is related to both nodes “6” and “7.” In that case, the set of edges “E”={(1,2), (1,3), (2,4), (2,5), (3,6), (3,7)}.

A “digraph” is similarly a pair (“N”, “E”) where N is a finite set of nodes, and “E” is a set of edges, each of which is an ordered pair (“x”,“y”), that is, a pair that specifies direction, where “x” is called the “head” and “y” is called the “tail.” A digraph corresponding to the example above would, like the graph described above, be defined by (“N”,“E”), where “N”={1,2,3,4,5,6,7} and “E”={(1,2), (1,3), (2,4), (2,5), (3,6), (3,7)}. However, the edges of“E” are not only pairs, but ordered pairs, representing not only a relationship, but a directed relationship. In the edges of “E” defined by “(1,2)” and “(1,3)”, “1” would be called the “head” and “2” and “3” would be called “tails.” Furthermore, “(1,2)” and “(1,3)” would specify a directed relationship (e.g., “1” is the parent of “2” and “3”).FIG. 1illustrates a digraph corresponding to the above example.

It is well known in the art that Graphs and Digraphs can be represented in a variety computer environments using a variety of well known constructs or data structures (e.g. linked lists, adjacency lists consisting of address pointers and node information, arrays, multi-dimensional arrays, matrices, data blocks etc.) Such constructs may be stored in memory or in storage media such as a disk or CD ROM.

Turning now toFIG. 1, in accordance with an embodiment of the present invention, it illustrates a digraph representing the interrelationship among relational database objects. In the particular embodiment disclosed inFIG. 1, the nodes “N” of the digraph each represent the objects of a relational database (e.g., a table, column, view etc.) For example, inFIG. 1, each of nodes “1,” “2,” “3,” “4,” “5,” “6” and “7” represent relational database tables. The edges “E” ofFIG. 1represent not only a general relationship among pairs of nodes, but more specifically the dependency of one node upon another. In the illustrative embodiment shown inFIG. 1, the “head” of each edge is dependent upon “tail” of that edge. Thus, in the embodiment illustrated inFIG. 1, node “1” is dependent upon nodes “2” and “3,” node “2” is dependent upon nodes “4” and “5” and node “3” is dependent upon nodes “6” and “7.” Put another way, the table represented by node “1” is dependent upon the tables represented by nodes “2” and “3,” as reflected by the edges “(1,2)” and “(1,3).” The table represented by node “2,” in turn, is dependent upon the tables “4” and “5,” as represented by the edges “(2,4)” and “(2,5),” and so on.

In the particular embodiment disclosed inFIG. 1, the illustrated digraph is represented by an adjacency matrix, which in turn, as is well known, can be represented by a two dimensional array. An adjacency matrix “M” representing a digraph is defined as “M”=(mij) where mij=“1” if there is an edge in “E” of the digraph from node niof “N” to node njof “N.”Otherwise, mijis zero. An adjacency matrix for the digraph inFIG. 1is shown below:

In the illustrative embodiment shown inFIG. 1, the entry in the first row and first column of the corresponding adjacency matrix is “0” because the digraph reflects no dependency relation ship between node “1” of the digraph and itself. In fact, the digraph expresses relationships amongst different nodes, not amongst the same node. Thus entries in the second row and second column, third row and third column, fourth row and fourth column, fifth row and fifth column, sixth row and sixth column, and seventh row and seventh column are all zero. Since the digraph inFIG. 1reflects that node “1” is dependent upon nodes “2” and “3,” however, the entries in the first row and second column and first row and third column are both “1.” Since the digraph reflects that nodes “4,” “5,” “6” and “7” are not dependent on any other nodes, the fourth, fifth, sixth and seventh rows of the matrix have exclusively “0” entries, and so on.

In the embodiment shown inFIG. 1, the adjacency matrix for the digraph is represented by a two dimensional array “M[I, J]” where M is the array name, J is an index to the first array dimension, or the row the matrix, and “J” is an index to the second array dimension, or column of the matrix. The definition and declaration of two dimensional arrays has been known for decades and can be effectuated in many computer languages and computing environments.

As noted above, there are many well known ways of representing a digraph in computing environments, and the present invention is by no means limited to the use of an adjacency matrix or two dimensional array. As just one example, the adjacency matrix could itself be represented by a relational database table.

As another example, the digraph could be represented by an adjacency list. An adjacency list is a linked list indicating, for each node in the digraph, which nodes are adjacent to that node. In the adjacency list embodiment, each item in the linked list could contain at least two fields: a “node” field, and a “link” field. The node field would identify a node. The link field could contain a pointer to an adjacent node item (i.e., an edge). Each pointer field in the adjacency list would represent an edge.

An Exemplary Method for Determining a Replication Order for Database Objects

In view of the above discussion, it will be understood in the discussion below of embodiments of the present invention that when “nodes” are discussed, such “nodes” may represent any database object. Similarly, when “edges” are discussed, such “edges” may represent a dependency relationship among database objects. Furthermore, such “nodes” and “edges” may be represented in a variety of ways in a variety of computing environments.

As noted earlier, in order to preserve the dependencies amongst database objects during replication or transfer, it is advantageous to transfer the objects in a particular order. More specifically, it is advantageous to transfer objects upon which others depend before the objects that depend upon them.

One aspect of the present invention derives from the observation that the problem of finding the correct order in which to transfer a set of database objects is equivalent to running a topological sort on a digraph such as the one illustrated inFIG. 1.

Turning now toFIG. 2, in accordance with an embodiment of the present invention, it shows a computer based method for topologically sorting the digraph shown inFIG. 1using a depth first search algorithm. In step200, the first node is processed. InFIG. 1, the first node is node “1.” Processing includes both “marking” and “stacking” the node. “Marking” simply means retaining some information (e.g. the change in value of a boolean flag) that reflects that the node has been processed.

“Stacking” means placing the node in a “stack” data structure. A “stack” is a type of data structure in which the placement of items in the stack and removal of items from the stack are governed by the “LIFO” construct. LIFO means “last in first out.” Thus items are removed from the stack in an order opposite to that in which they were added in the stack. Put another way, the most recently placed item is the first removed. It is well known that a stack can be represented using a variety of computing constructs in almost any computing environment.

In Step210, the computer based process determines whether the stack is empty. If the stack is empty then it means that either there are no nodes (i.e., database objects) in the digraph, or that all such nodes have already been transferred or replicated. Thus, in Step250, the computer based method ends. But if the stack is not empty, it means that both the digraph and the stack have nodes and that not all of them have been transferred or replicated.

Thus, in Step220, the computer-based method determines if the node at the “top” of the stack (i.e, the one placed most recently and that will be removed first) has an adjacent node in the digraph (i.e., a node connected by an edge) that has not been marked. If there is no such adjacent node, that means that the node at the top of the stack either has no adjacent nodes or that its adjacent nodes are marked, and therefore have already been processed and stacked. If an adjacent node has been processed, marked and stacked, it means that the adjacent node is dependent upon the node at the top of the stack because the process began with Node “1” inFIG. 1. Thus, in Step240, the node at the top of the stack is removed from the stack and is transferred or replicated to a destination or subscriber, because there can be no nodes upon which it depends that will be later transferred. Processing then continues to Step210to again determine if the stack is empty.

However, if in Step220it is determined that there is an adjacent node in the digraph that has not been marked, it means that the node at the top of the stack is dependent upon the adjacent node because, again, the process began with Node “1” inFIG. 1. Thus, in Step230, the adjacent node is processed, marked and placed at the top of the stack. It thus becomes the new candidate in line to be removed from the stack and replicated next. Processing continues to Step220to again determine if the node at the top of the stack has any unmarked adjacent nodes in the graph.

In this way, the method ensures that nodes (database objects) are transferred only after those upon which they depend.

The order of processing and transfer of database objects represented inFIG. 1, using the method ofFIG. 2, is now described as an example. In the method ofFIG. 2, the first node inFIG. 1, node “1,” is first processed, marked and placed at the top of the stack. In Step210, the computer based process determines whether the stack is empty. Here, it is not because it contains node “1.” Thus processing continues to Step220.

In Step220, the computer based process determines if the node at the top of the stack has an unmarked adjacent node in the digraph. Here, it does because there is an edge between node “1” and node “2” inFIG. 1, and node “2” has not been marked. Thus processing continues to Step230. In Step230, node “2” is processed, marked and placed on the stop of the stack. Processing continues to Step220.

In Step220, the computer based process determines if node “2” has an unmarked adjacent node in the digraph. Node “4” is such an unmarked adjacent node. Thus processing continues to step230.

In Step230, node “4” is processed, marked and placed on top of the stack. Note that at this point the stack consists of nodes “421.” Processing continues to step220.

In Step220, the computer based method determines if node “4” has an unmarked adjacent node in the digraph. It does not. Thus processing continues to step240.

In Step240, node “4” is removed from the top stack and replication and transfer of node “4” is initiated. Processing continues to Step210.

In Step210, the computer based method determines if the stack is now empty. It is not because node “2” is now at the top of the stack and node “1” is below it. Processing thus continues to Step220.

In Step220, the computer based process determines that node “2” has an unmarked adjacent node (node “5”). In Step230, node “5” is processed, marked and stacked. Note that the stack now consists of nodes “521.”

In Step220, the computer based method determines that node “5” does not have an unmarked adjacent node. In Step240node “5” is removed from the stack and transferred for replication.

In Step210, the computer process determines that the stack is not empty and in step220, it determines that node “2,” now the top stack node, has no unmarked adjacent digraph node at this point. Node “2” is removed from the stack and its replication is initiated in Step240.

In Step210, the computer process determines that the stack is not empty and in step220, it determines that node “1,” now the top stack node, has an unmarked adjacent node (node “3”). In Step230, node “3” is processed, marked and stacked, and so.

Thus, it can be seen that according to the algorithm ofFIG. 2, the nodes (database objects) ofFIG. 1will be transferred in the following order:4,5,2,6,7,3,1. Again, inFIG. 1, node “1” is dependent upon nodes “2” and “3,” node “2” is dependent upon nodes “4” and “5” and node “3” is dependent upon nodes “6” and “7.” Thus, in each case, nodes (database objects) are transferred only after those upon which they depend.

The above-disclosed depth first search algorithm can also be implemented in a variety of other ways. For example, in accordance with one aspect of an embodiment of the present invention, a depth first search can be performed on an adjacency list implementation of a digraph using a recursive algorithm, as exemplified by the following source code excerpt:

In this embodiment, a stack is used for cycle detection and a node is added to an object creation list when it is marked black.

In addition, in some implementations of the present invention, the order of the steps of the embodiment illustrated inFIG. 2can be altered. For example, Step240ofFIG. 2illustrates how a database object is replicated as soon as its corresponding node is removed from the stack (i.e., as soon as the depth first search algorithm determines that there are no unmarked adjacent nodes).

But in another aspect of an embodiment of the present invention, replication need not take place “on-the-fly” during the topological sort. In accordance with this aspect, the database object is not replicated as soon as the depth first search algorithm determines that the database object is next in order to be transferred. Instead, once the topological sort determines that a database object is next in-line to be replicated or transferred, the placement of the database object in the order of transfer is saved for later use. Replication or transfer of all the database object is not initiated until after the placement of each database object is determined.

An Exemplary Method for Replicating Database Objects

Turning now toFIG. 3, it shows in greater detail the step of replicating or transferring database objects shown in block240ofFIG. 2. In step300, after the node representing a database object is removed from the stack, the data object is copied from the publisher or source computer. In Step310the copy is stored on the subscriber or destination computer. Finally, in Step320, the copy may be deleted from one or more locations of the publisher or source computer.

Another Exemplary Method for Determining a Replication Order for Database Objects

In the depth first search example shown above, an embodiment of the present invention was shown to advantageously cause the transfer of interdependent database objects in the correct order, one which allows the preservation of dependency information. However, transferring database objects in the proper order does not guarantee that data dependencies will be preserved.

For instance, in the example above, the database objects ofFIG. 1were transferred in the order “4,5,2,6,7,3,1.” Each object was transferred in the correct order. But even though node “4” was correctly transferred before node “2,” the deletion and recreation of node “4” attendant to the replication or transfer process may impair information on the publisher that reflects the dependent relationship between node “2” and node “4.” More specifically, when node “4” is deleted and recreated, critical information reflecting the dependence of node “2” upon node “4” may be impaired on the publisher. When node “2” is later transferred, the impaired information may be transferred with it.

Turning now toFIG. 4, it illustrates a method for traversing the interrelated objects of a relational database that addresses the problem of dependency information loss attendant to the deletion and recreation of database objects that other objects are dependent upon.FIG. 4differs fromFIG. 2in that steps405and steps435have been added. In general, inFIG. 4, when the depth-first search algorithm attempts to enumerate all outgoing edges (dependencies) of a given node (database object), a request is made to begin an atomic transaction and then a temporary copy (e.g., via a T-SQL command) of the node/database object is created under a different name. Once the temporary object is successfully created, the dependency information of the temporary object is retrieved and the transaction is rolled back thereby leaving no trace of the temporary object behind. Assuming the temporary copy is initiated via a T-SQL command, then the temporary copy will have the same T-SQL text definition as the original object. The temporary copy will also have the same dependencies as the original object. In addition, the dependency information of the temporary copy must be accurate at the moment of creation because the object that it is dependent upon stays unchanged for the duration of the transaction. Thus, the dependency information of the temporary object can be used as accurate dependency information of the original object.

InFIG. 4, in Step400a computer based method processes, marks and stacks a first node of a digraph. UnlikeFIG. 2, in Step405ofFIG. 4, a temporary copy of the first graph node is initiated. The dependency information of the temporary copy must be accurate at the moment of creation because the object that it is dependent upon stays unchanged for the duration of the transaction. In Step410, the computer based method determines if the stack is empty. If the stack is empty, then in step450the process ends. If the stack is not empty, then in Step420, the computer process determines if the top stack node has an adjacent unmarked node in the digraph. If there is such an unmarked adjacent node, then (1) in Step430, the unmarked adjacent node is processed, marked, stacked, (2) in step435, a temporary copy is made of the adjacent unmarked node and (3) processing continues back to step420. If there is no such adjacent unmarked node, then in step440, (1) the top stack node is removed from the stack and a transfer of the top stack node is initiated and (2) processing continues to step410.

The order of processing and transfer of database objects represented inFIG. 1, using the method ofFIG. 4, is now described as an example.

In the method ofFIG. 4, the first node inFIG. 1, node “1,” is first processed, marked and placed at the top of the stack. In Step405, a temporary copy of node “1” is created.

In Step410, the computer based process determines whether the stack is empty. Here, it is not because it contains node “1.” Thus processing continues to Step420.

In Step420, the computer based process determines if the node at the top of the stack has an unmarked adjacent node in the digraph. Here, it does because there is an edge between node “1” and node “2” inFIG. 1, and node “2” has not been marked. Thus processing continues to Step430.

In Step430, node “2” is processed, marked and placed on the stop of the stack. In Step435, a temporary copy of node “2” is created. Processing continues to Step420.

In Step420, the computer based process determines if node “2” has an unmarked adjacent node in the digraph. Node “4” is such an unmarked adjacent node. Thus processing continues to step430.

In Step430, node “4” is processed, marked and placed on top of the stack. In Step435, a temporary copy of node “4” is created. Processing continues to step420.

In Step420, the computer based method determines if node “4” has an unmarked adjacent node in the digraph. It does not. Thus processing continues to step440.

In Step440, node “4” is removed from the top stack and replication and transfer of node “4” is initiated. Processing continues to Step410. Note that a temporary transaction has been opened for node “2,” and the dependency information for node “2” stored in the temporary copy is not impaired by deletion and recreation attendant to replication of node “4.”

In Step410, the computer based method determines if the stack is now empty. It is not because node “2” is now at the top of the stack and node “1” is below it. Processing thus continues to Step420.

In Step420, the computer based process determines that node “2” has an unmarked adjacent node (node “5”). In Step430, node “5” is processed, marked and stacked. In Step435, a temporary copy of node “5” is created. Processing continues to step420.

In Step420, the computer based method determines that node “5” does not have an unmarked adjacent node. In Step440node “5” is removed from the stack and transferred for replication. Processing continues to step410. Note that a temporary transaction has been opened for node “2,” and the dependency information for node “2” stored in the temporary copy is not impaired by deletion and recreation attendant to replication of node “5.”

In Step410, the computer process determines that the stack is not empty and in step420, it determines that node “2,” now the top stack node, has no unmarked adjacent stack node at this point. Node “2” is removed and its replication is initiated in Step440, and so on. A temporary transaction has been opened for node “1,” and the dependency information for node “1” stored in the temporary copy is not impaired by deletion and recreation attendant to replication of node “2.”

As withFIG. 2, in the method ofFIG. 4, in each case, nodes (database objects) are transferred only after those upon which they depend.

As noted earlier, the depth first search algorithm disclosed inFIG. 4can also be implemented in a variety of other ways, including a recursive algorithm performed on an adjacency list, as exemplified by the earlier described source code excerpt.

Also the order of the steps of the embodiment illustrated inFIG. 4can be altered. For example, Step440ofFIG. 4illustrates how a database object is replicated as soon as its corresponding node is removed from the stack. But in another aspect of an embodiment of the present invention, the database object is not replicated as soon as the depth first search algorithm determines that the database object is next in order to be transferred. Instead, as noted earlier, replication or transfer of all the database object can be deferred until after the order placement of each database object is determined.

Another Exemplary Method for Replicating Database Objects

Turning now toFIG. 5, it shows in greater detail the step of replicating or transferring database objects shown in block440ofFIG. 4. In step500, after the node representing a data object is removed from the stack, the database object is copied from the publisher or source computer using the temporary copy created for the database object. As described above, the temporary copy contains accurate data dependency information. In Step510the copy is stored on the Subscriber or destination computer. In Step520, the copy is deleted from one or more locations of the publisher or source computer. Finally, in Step530, the temporary copy transaction for the database object is terminated.

Exemplary Operating Environment

Turning now toFIG. 6, it illustrates on a high level an exemplary architecture environment in which embodiments of the present invention may effect replication and transfer of data. In an embodiment of the present invention, the data transfer occurs in a Microsoft® SQL Server™ programming environment and the database objects transferred are SQL database objects. In a Microsoft® SQL Server™ programming environment embodiment of the present invention, replication of a database, including the steps ofFIGS. 4 and 5, is initiated by a network administrator using a “Replication Wizard” option provided by a Microsoft® SQL Server™ GUI (“Graphical User Interface”).

During replication, data transfer occurs from a publisher600to a subscriber610. The publisher600is a server or database that sends its data to another server or database. The subscriber610receives data form the publisher600.

Microsoft® SQL Server™ provides various types of database replication options, including snapshot replication, transactional replication and merge replication. Snapshot replication distributes data exactly as it appears at a specific moment in time and does not monitor for updates to the data. With transactional replication, an initial snapshot of data is applied at the subscriber, and then when data modifications are made at the publisher, the individual transactions are captured and propagated to the subscriber. Merge replication is the process of distributing data from the publisher to the subscriber, allowing both the Publisher and the Subscriber to make updates, and then merging the updates between the publisher and the subscriber when both are connected.

In the Microsoft® SQL Server™ environment, the steps of creating a temporary database object copy in blocks405and435ofFIG. 4, and the steps of using the temporary copy transaction and terminating it in blocks500and530ofFIG. 5, may be performed using T-SQL (Transact-SQL). Transaction SQL is a set of programming extensions provided by Microsoft that adds several features to standard SQL. These supplemental features include transaction control, relational database table row processing and support for declared variables. Database management tools such as the SQL Distributed Management Object Model (SQLDMO) and the SQL Management Object Model (SMO) provide the capability of scripting the T-SQL definitions of database objects under different object names. In an embodiment of the present invention, a T-SQL script generated from SMO is used for the purpose of creating the temporary object as illustrated in blocks405and435ofFIG. 4.

Turning now toFIG. 7, it illustrates an exemplary network environment in which an embodiment of the invention may be implemented. The operating environment inFIG. 7is only one example of a suitable operating environment and is not intended to suggest any limitation as to the scope of use or functionality of the invention. Other well known computing systems, environments, and/or configurations that may be suitable for use with the invention include, but are not limited to, personal computers, server computers, hand-held or laptop devices, multiprocessor systems, microprocessor-based systems, programmable consumer electronics, network PCs, minicomputers, mainframe computers, and other distributed computing environments that include any of the above systems or devices, and the like.

In the exemplary environment ofFIG. 7, the network may include client computers721, a server (publisher) computer722, and server (subscriber) computer723. Server (publisher) computer722has an associated database772. Server (subscriber) computer723also has an associated database770.

The client computers721and the server computers722723are in electronic communication via communications network780, e.g., the Internet. Client computers721and server computers722723are connected to the communications network by way of communications interfaces782. Communications interfaces782can be any one of the well-known communications interfaces such as Ethernet connections, modem connections, and so on.

Server computers722723provide management of databases770772by way of database server system software, which may conform, for example, to the relational data model. Such database software may be, for example, Microsoft® SQL Server™ software. As such, servers722723act as a storehouse of data and provide that data to a variety of data consumers.

Client computers721that desire to use the data stored by server computers722723can access the databases770772via communications network780. Client computers721request the data by way of queries.

In the example ofFIG. 7, a network administrator may want to replicate the database772, which consists of data stored in tables750,752, and754, and transfer the tables to database770. In this way, reporting may be more easily facilitated to a greater cluster of client computers721, from both server (publisher) computer722and server (subscriber) computer723. To accomplish his or her task, the administrator may log into Microsoft® SQL Server™ software located on, for example, the server (publisher) computer722. After designating database772as the publisher, or source of data, and database770as the subscriber, or destination of data, the administrator initiates a replication sequence. The database objects thus stored in database772are replicated in database770. In accordance with the presently discussed embodiment, the transfer is effectuated by replication software on the server (publisher) computer722. The replication software operates in accordance with the steps ofFIGS. 1-5and therefore preserves the dependencies amongst the database objects transferred during replication. The data ultimately stored in database770thus contains wholly accurate dependency information.

Turning now toFIG. 8, an exemplary computing device800is shown to illustrate the client computers721, server (publisher) computer722and server (subscriber) computers723in greater detail. In its most basic configuration, computing device800typically includes at least one processing unit802and memory804. Depending on the exact configuration and type of computing device, memory804may be volatile (such as RAM), non-volatile (such as ROM, flash memory, etc.) or some combination of the two. This most basic configuration is illustrated inFIG. 8by dashed line806. Additionally, device800may also have additional features or functionality. For example, device800may also include additional storage (removable and/or non-removable) including, but not limited to, magnetic or optical disks or tape. Such additional storage is illustrated inFIG. 8by removable storage808and non-removable storage810.

Computer storage media includes volatile and nonvolatile, removable and non-removable media implemented in any method or technology for storage of information such as computer readable instructions, data structures, program modules or other data. Memory804, removable storage808and non-removable storage810are all examples of computer storage media. Computer storage media includes, but is not limited to, RAM, ROM, EEPROM, flash memory or other memory technology, CD-ROM, digital versatile disks (DVD) or other optical storage, magnetic cassettes, magnetic tape, magnetic disk storage or other magnetic storage devices, or any other medium which can be used to store the desired information and which can accessed by device800. In an embodiment of the present invention, executable instructions performing the steps ofFIGS. 2-4may be stored on such computer storage media.

Device800may also contain communications connection(s)812that allow the device to communicate with other devices. Communications connection(s)812is an example of communication media. By way of example, and not limitation, communication media includes wired media such as a wired network or direct-wired connection, and wireless media such as acoustic, RF, infrared and other wireless media.

Device800may also have input device(s)814such as keyboard, mouse, pen, voice input device, touch input device, etc. Output device(s)816such as a display, speakers, printer, etc. may also be included. All these devices are well know in the art and need not be discussed at length here.

While the invention has been described and illustrated with reference to specific embodiments, those skilled in the art will recognize that modification and variations may be made without departing from the principles of the invention as described above and set forth in the following claims. Accordingly, reference should be made to the appended claims as indicating the scope of the invention.